•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 455,985 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,789 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 433 | Replies: 4
![]() |
•
•
Join Date: Dec 2007
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
A College offers a course that prepares students for the state licensing exam for real estate brokers. Last Year, several of the students who completed this course took the licensing examination. Naturally, the college wants to know how well its students did on the exam. You have been asked to write a program to summarize the results. You have been given a list of these 10 students. Next to each name is written a 1 if the student passed the exam or a 2 if the student failed.
Your program should analyze the results of the exam as follows.
1. Input each test result (i.e., a 1 or a 2). Display the message “Enter result” on the screen each time the program requests another test result.
2. Count the number of test results of each type
3. Display a summary of the test results indicating the number of students who passed and the number of students who failed.
4. if more than 8 students passed the exam, print the message “ Raise tuition”
Your program should analyze the results of the exam as follows.
1. Input each test result (i.e., a 1 or a 2). Display the message “Enter result” on the screen each time the program requests another test result.
2. Count the number of test results of each type
3. Display a summary of the test results indicating the number of students who passed and the number of students who failed.
4. if more than 8 students passed the exam, print the message “ Raise tuition”
Good day..you're going to have to show some effort...we don't do assignments for students...you must show some effort. But a few things:
1. To display the "Enter Result" on the screen each time, you woukd use something like this:
2. You use a counter to keep track of which students failed and passed.
3. To check if more than 8 students the exam, you use an if/else statement:
Hope this helps, but you still got ways to go!
1. To display the "Enter Result" on the screen each time, you woukd use something like this:
char again = 'y';
while (again =='y')
{
//do something
}
cout<<"Go again?(y/n):"<<endl;
cout<<"Enter Result"<<endl;3. To check if more than 8 students the exam, you use an if/else statement:
if (numpassed>8)
{
cout<<"Raise tuition"<<endl; I shot the sheriff....but I didn't shoot the deputy
•
•
Join Date: Dec 2007
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
Here's the finished program...it compiled and ran like RoadRunner..I used Dev C++ as my compiler.
//Created by Kattalyst
//2/12/07
//This Program Calculates Grades
# include <iostream>
# include <cmath>
using namespace std;
int main()
{
const int again = 10;
int result, totalGrade;
int fail=0,counta=0,count = 1;
cout<<"Welcome To Grade Score"<<endl;
do{
cout<<"Enter Result: ";
cin>>result;
count++;
if (result==1)
{
counta++;
}
else
{
fail++;
}
}while (count <= again);
cout<<endl;
cout<<"Number of Students passed = "<<counta;
cout<<endl;
cout<<"Number of Students Failed = "<<fail<<endl;
if (counta>8)
{
cout<<"Raise tuition"<<endl;
}
else
{
cout<<"Do not Raise Tuition"<<endl;
}
system ("pause");
return 0;
}![]() |
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Help with gui loop. (C)
- Loop...without the loop (Java)
Other Threads in the C++ Forum
- Previous Thread: Constructor still not working
- Next Thread: New to try/catch



Linear Mode