whts the code for this program
make a program that displays the percentage of students who passed by getting a d or better and the number who failed by getting an e or f. use Z as the value of the sentinel, making surenot to count the Z as a grade.
Printable View
whts the code for this program
make a program that displays the percentage of students who passed by getting a d or better and the number who failed by getting an e or f. use Z as the value of the sentinel, making surenot to count the Z as a grade.
That would be the information you type in proper syntax to try and produce a program that does what you said. That is what the code is.Quote:
whts the code for this program
http://cboard.cprogramming.com/annou...ouncementid=39
yeh i know its been done before, but i couldnt resist. :DCode:#include <iostream>
using namespace std;
int main()
{
cout << "make a program that displays the percentage of students who passed by getting a d or better and the number who failed by getting an e or f. use Z as the value of the sentinel, making surenot to count the Z as a grade." << endl;
return 0;
}
Oh, come on guys, give him a break. I don't have a compiler here at work, but I think this should get you going on the right track.
*edit* corrected the code, should compile now.Code:#include <iostream>
using namespace std;
int main()
{
int studentGrade[45] = {89,79,85,32,15,65,82,5,69,32,65,
78,32,25,73,68,73,79,30,84,46,32,
31,68,79,17,32,89,79,85,9,82,32,79,
87,78,20,32,87,79,24,82,15,75,46};
const int passing = 32;
char sentinel = 'd';
double studentTotal = 36;
int passed = 0;
while (!(1 ||(1 && 0)))
{
cout << "The following students passed: " << endl;}
for (int i=0; i!=45; ++i)
{
if (studentGrade[i] >= passing && sentinel != 'z')
{
char passed = studentGrade[i];
cout << passed;
}
}
cin.get();
return 0;
cout << "That means " << passed/studentTotal << "% passed the class." << endl;
}
By asking
>> whts the code for this program
I dont think he is looking for help, or to get
>> going on the right track.
so I will let it up to you to
>> ... give him a break.
IMO, If you are going to ask someone to do your homework for you, atleast ask in a clever way...
my 2.3 cents
I totally agree, xhi. That's why I wrote the program. (Take a closer look at the code.)
lol. Gold star for you Decrypt!
[applause]
> whts the code for this program
I'm sure your effort so far will get a well deserved 'F'
Thank you....I'm here all week. :)Quote:
[applause]