the question says:
Develop a program that asks for a students name and final grade (in numberical form) and prints out the students name, letter grade, and GPA.
e.g. Please enter students name: Kieran Ryan
Please enter Kieran Ryan's grade: 100
Kieran Ryan got an A in your class and has a GPA of 4.0!!!
Use the following to calculate the Letter Grade and GPA:
Percent GPA Letter Grade
90-100 4.0 A
85-98 3.5 B+
80-84 3.0 B
75-79 2.5 C+
70-74 2.0 C
60-69 1.0 D
0-59 0.0 F
I'm stuck at:
#include %26lt;stdio.h%26gt;
#include %26lt;iostream%26gt;
#include %26lt;string%26gt;
using namespace std;
int main ()
{
string mystr;
cout %26lt;%26lt; "What's your name? ";
getline (cin, mystr);
cout %26lt;%26lt; "nice name " %26lt;%26lt; mystr %26lt;%26lt;"\n";
cout %26lt;%26lt; "What is your grade? ";
getline (cin, mystr);
if= mystr
90-100 4.0 A
85-98 3.5 B+
80-84 3.0 B
75-79 2.5 C+
70-74 2.0 C
60-69 1.0 D
0-59 0.0 F
cout %26lt;%26lt; "the student got" %26lt;%26lt; mystr %26lt;%26lt; " which is an A\n";
system("pause");
return 0;
}
could someone be an angel and save me
please
Okey i'm lost with this question ---- c++ program can u please help me!?
int main ()
{
string mystr;
double mark, gpa = 0.0;
char grade[2] = 'F ';
cout %26lt;%26lt; "What's your name? ";
getline (cin, mystr);
cout %26lt;%26lt; "nice name " %26lt;%26lt; mystr %26lt;%26lt;"\n";
cout %26lt;%26lt; "What is your grade? ";
cin %26gt;%26gt; mark;
if (mark %26gt;= 90 %26amp;%26amp; mark %26lt;= 100)
{
*grade = 'A';
gpa = 4.0;
}
else if (mark %26gt;= 85)
{
*grade = 'B';
grade[1] = '+';
gpa = 3.5;
}
else if (mark %26gt;= 80)
{
*grade = 'B';
gpa = 3.0;
}
else if (mark %26gt;= 75)
{
*grade = 'C';
grade[1] = '+';
gpa = 2.5;
}
else if (mark %26gt;= 70)
{
*grade = 'C';
gpa = 2.0;
}
else if (mark %26gt;= 60)
{
*grade = 'D';
gpa = 1.0;
}
else
{
*grade = 'F';
gpa = 0.0;
}
cout %26lt;%26lt; mystr %26lt;%26lt; "got a";
if (*grade == 'A') cout %26lt;%26lt; 'n';
cout %26lt;%26lt; grade %26lt;%26lt; " in your class and a GPA of " %26lt;%26lt; gpa %26lt;%26lt; endl;
system("pause");
return 0;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment