please please please Need help urgently
This is the code of my assignment programme problem is this it takes the inputs properly but close the cmd window without showing any result. Where i m making any mistake please mention?and correct the code please. please please please
Code:
#include <iostream.h>
using namespace std;
main()
{ //Initialization of veriables
char grad; //to take inputs of grades A or B
int tnos, ga, gb;
tnos = 1; //Total number of students
ga = 0; //Total number of grad 'a'
gb = 0; //Total number of grad 'b'
do
{
cout<<"Enter the Grade of Student "<<tnos<<" :"; //to take inputs
cin>>grad;
if(grad=='a') //to decide while the grade is 'a', 'b' or anyother
{
ga=ga+1; //counter to count 'a' grades
tnos=tnos+1;
}
else if(grad=='b')
{
gb=gb+1; //counter to count 'b' grades
tnos=tnos+1;
}
else
{
cout<<"Please enter only grads A or B:";
}
}
while(tnos<=10); //maximum inputs to take or total number of students whos grades are required
{
cout<<"Total A grades are : "<<ga;
cout<<"Total B grades are : "<<gb;
}
//Now on the basis of total number of grades we shell show the status of a class.
if(ga<=2)
cout<<"Your class is Poor..!";
else if(ga<=7)
cout<<"Your class is Good..!";
else
cout<<"Your class is Brilliant..!";
}
Re: please please please Need help urgently
Quote:
Originally Posted by
sonog4
This is the code of my assignment programme problem is this it takes the inputs properly but close the cmd window without showing any result.
Run the program from the command-line.
Regards,
Paul McKenzie
Re: please please please Need help urgently
using namespace std;//before main
system("pause");//before return whatever
return whatever;