In this article I would like to share with you a program that I wrote a long time that will ask the user to enter ten grades and then our program will count how many passed and failed grades given by our user of our program. The code is very simple enough it uses one dimensional array as its basic data structure and if - else statement for conditions.
If you have some questions please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
People here in the Philippines who wish to contact me can reach me thru my mobile number 09173084360.
Thank you very much and Happy Programming.
Sample Program Output
Program Listing
// Pass and Failed Grades Counter
// Author : Mr. Jake Rodriguez Pomperada, MAED - Instructional Technology
// Date : November 13, 2009 Friday 10:22 PM
// Email : jakerpomperada@yahoo.com
// Tool : Code Blocks
// Language : C++
#include <iostream>
using namespace std;
main() {
int list=0,pass=0,fail=0, grades[10];
cout << "\n\t\tPASS AND FAILED GRADES COUNTER";
cout << "\n\t Created By: Mr. Jake R. Pomperada,MAED-IT";
cout << "\n\n";
for (list=0; list < 10; list++) {
cout << "Enter Grade No " << list+1 << " :" ;
cin >> list[grades];
}
for (list=0; list < 10; list++) {
if (list[grades] >= 75) {
pass++;
}
else {
fail++;
}
}
// display pass grades and failed grades
cout << "\n";
cout << "\n==============================";
cout << "\n====== Generated Report ======";
cout << "\n==============================";
cout << "\n";
cout << "Passed Grades => ";
for (list=0; list < 10; list++)
{
if (list[grades] >= 75) {
cout << " " << list[grades] << " ";
}
}
cout << "\n";
cout << "Failed Grades => ";5
for (list=0; list < 10; list++)
{
if (list[grades] < 75) {
cout << " " << list[grades] << " ";
}
}
cout << "\n";
cout << "\nNumber of Passed Grades => " << pass << ".";
cout << "\nNumber of Failed Grades => " << fail << ".";
cout << "\n\n";
system("pause");
}
// End of Code
what is cout ?
ReplyDelete