Marketplace

Related Articles

More

Related Categories

Recently Added

More

Join StudyUp.com Today

It's always free and anyone can join!

Watch StudyUp Demo Video Now

You Recently Visited

Second Grade Writing Prompts

Darrell Said:

Can you help me with another Writing Prompt idea??

We Answered:

"The girl who rode her bicycle on the bus."
"The boy who slept on the escalator."
"The tornado in the bedroom."
"The giant in the dollhouse."
"The man who grew a flower in his beard."

Marshall Said:

I need second opinion..What can you tell about this communication?Thx.?

We Answered:

The teacher is saying,1, I am not volunteering any info to help you[tutor] and 2, better luck next year!

Lawrence Said:

Write a program that prompts the user to enterthe number of students and each student’s name and score, and fi?

We Answered:

Instead of trying to change your code, I will show you the basics of how you should be doing this.

Declare all of the variables here. Do not declare some variables later on, but do them all here.
Output the message for the number of students.
Read the input.
Use a for loop instead of the while loop. for (int i = 0; i < classSize; i++)
Output the message to get the name.
Input the name.
Output the message to get the score.
Input the score.
Check if i == 0. If so, add the name and score as the highest.
Else, check if the current score is higher than the highest score. If so, put the highest score and name into the second highest score and name. Put the current score and name as the highest.
Else, check if the current score is higher than the second highest. If so, put the current score and name into the second highest score and name.
End the if statement.
End the for loop.
Output the results.

Good luck with it.

Carol Said:

Help writing C++ Program!?

We Answered:

The problem with your code is that each time the user enters another student's grade, it replaces the last student's grade without saving it. So here, let me fix it:

int main()
{

double grade = 0.0, highGrade = 0.0, secondHighGrade = 0.0;
int total = 0;

cout << "How many students do you need to enter grades for? ";
cin >> total;

for(int student = 0; student < total; student++)
{
cout << "Enter the student's grade: ";
cin >> grade;
if(grade > highGrade)
highGrade = grade;
else if(grade > secondHighGrade)
secondHighGrade = grade;
}

printf("The highest scored grade was %L, and the second highest scored grade was %L.", highGrade, secondHighGrade);

return 0;
}

Discuss It!