+ 5
Need helps with this!
To study at a university, you must score higher than or equal to 90 out of 100 points on an exam. The given program takes points as input. Task Complete the code to output "pass" if the score is higher than or equal to 90, otherwise print "fail". Sample Input 95 Sample Output pass I passed the first one, but I don’t get the second one “else” All my output is pass even though I put else statement on it
18 Antworten
+ 4
Thanks, it makes sense!
+ 3
#include <iostream>
using namespace std;
int main() {
int score;
score = 100;
if ( score >= 90) {
printf("pass");
}
else {
printf("fail");
}
//your code goes here
return 0;
}
+ 3
Yea, It works!!
+ 2
But can you guys explain me, why it doesn’t work before and what cin>>mean
+ 2
Altesse cin is the character stream object used in C++ for getting console input (hence, the name, cin).
When Code Coach gives you starter code, usually you will find a comment that says "your code goes here". You won't need to edit the starter code. Just add your own code after that comment.
+ 1
#include<iostream>
using namespace std;
int main()
{
int points;
cout<<"Enter your points:";
cin>>points;
if(points>=90)
{
cout<<"pass";
}
else
{
cout<<"fail";
}
return 0;
}
+ 1
cin works like scanf. scanf and printf works for c but cin and cout are respectively used in c++
+ 1
#include <iostream>
using namespace std;
int main() {
double points;
cin >> points;
if (points > 89) {
cout << "pass"<< endl;
}
else {
cout << "fail" << endl;
}
//your code goes here
return 0;
}
Good Luck
0
#include<iostream>
using namespace std;
int main(){
int score;
cin >> score;
if(score > 90 || score == 90)
cout << "pass";
else
cout << "fail";
}
0
//it's very easy
#include<iostream>
using namespace std;
int main()
{
float point;
cout<<"Enter Marks : ";
cin>>point;
if(point >= 90.0)
{
cout<<"\nPass 👏👏👏";
}
else
{
cout<<"\nSorry, you are FAIL, try again next time all the best 👍;
}
return 0;
}
}
0
Int x ;
scanf(x):
If (x >= 90 & X < 100)
{
Printf('PASS');
}
ELSE
{
PRINTF('FAIL'):
}
0
#include ......
........
...........
int score;
cout << "enter the scores";
cin >>scores;
if (scores > 90 ){
cout << "you passed \n";
}
else {
cout "you failed \n";
}
//This' the simplest way to do!😎
0
You are given a Point class, which defines a point on a 2D grid (x, y).
The program creates a Point in main based on user input and calls the shift() function, which should increment the coordinates by the given step.
However, the code is not working, as the coordinates are private.
Modify the code to fix it.
0
Fill in the blanks to set the points value based on the category value, which is a char.
int points = 0;
if(category == 'A')
points = 100;
}
else
if(category == 'B') {
points = 70;
else {
points = 50;
}