- 1
Hello how can I do this in c++
First I need input from the user if he is natura or social student then gender then mark after that if he's natural and male above 380 mark out of 700 passed for natural female above 360 passed else failed for social male above 350 passed and social female above 330 passed else failed
6 Respostas
+ 2
//Like this?
#include <iostream>
using namespace std;
int main()
{
char G[10], o[5];
int x;
cout<< " Enter your stream : ";
cin>> o;
cout<<o;
cout<< "\n Enter your gender : ";
cin>> G;
cout<<G;
cout<< "\n Enter your mark : ";
cin>> x;
cout<<x<<endl;
if ((x>700) || (x<0))
cout<<"invalid\n";
else if ((x>=380) || (x>=360))
cout<<"passed\n";
else if ((x>=350) || (x>=330))
cout<<"passed\n";
else
cout<<"failed\n";
return 0;
}
+ 2
Where's the problem?
+ 2
I didn't know how to include gender mark and stream in the code
+ 1
any code you have written so far ?
0
#include <iostream>
using namespace std;
int main()
{
char G, o;
int x;
cout<< " enter your stream\n";
cin>> o;
cout<< " enter your gender\n";
cin>> G;
cout<< " enter your mark\n";
cin>> x;
if ((x>700) || (x<0))
cout<<"invalid\n";
else if ((x>=380) || (x>=360))
cout<<"passed\n";
else if ((x>=350) || (x>=330))
cout<<"passed\n";
else
cout<<"failed\n";
return 0;
}
0
Yes☝️