noob C++ problem

dubstar

format c:
Joined
Dec 3, 2002
Messages
1,357
i don't understand what i did wrong. i looked at the error checker but i dont really understand what it is saying...

"
1>gradecpp.cpp(96) : error C2146: syntax error : missing ';' before identifier 'endl'
"

but why would you need a semi colon before endl? ?? plus there is a problem with "
if ( status = "FT" )
{
cout << "What is your GPA?" endl;
cin >> gpa;
}
Code:
[SIZE=2][COLOR=#008000]/*[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]******************************************[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]** Program name: GradeCheck *****[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]*** Date: March 02 2007 ****[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]**** Author: Alan Rosenquist ***[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]***** Description: Calcs GPA **[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]******************************************[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]*/[/COLOR][/SIZE]
 
 
 
 
[SIZE=2][COLOR=#008000]// Library[/COLOR][/SIZE]
 
[SIZE=2][COLOR=#0000ff]#include[/COLOR][/SIZE][SIZE=2][COLOR=#a31515]<iostream>[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]#include[/COLOR][/SIZE][SIZE=2][COLOR=#a31515]<string>[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]namespace[/COLOR][/SIZE][SIZE=2] std;[/SIZE]
 
[SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][SIZE=2] main()[/SIZE]
[SIZE=2]{[/SIZE]
 
 
 
 
[SIZE=2][COLOR=#008000]// Header[/COLOR][/SIZE]
 
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]" \t ****** * * ******* ***** ******* "[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]" \t* * * * * * * "[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]" \t* * * * * ***** * "[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]" \t* * * * * * * * "[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]" \t ****** ****** ******* ****** * "[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]" \t * Program name:"[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]" \t * Date: March 02 2007"[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]" \t * Author: Alan Rosenquist"[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]" \t * Description:"[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]""[/COLOR][/SIZE][SIZE=2]<< endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]""[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
 
 
 
 
[SIZE=2][COLOR=#008000]// Declaration of[/COLOR][/SIZE]
 
[SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][SIZE=2] id; [/SIZE][SIZE=2][COLOR=#008000]// student id number[/COLOR][/SIZE]
[SIZE=2]string fname; [/SIZE][SIZE=2][COLOR=#008000]// students first name[/COLOR][/SIZE]
[SIZE=2]string lname; [/SIZE][SIZE=2][COLOR=#008000]// students last name[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][SIZE=2] cbis11; [/SIZE][SIZE=2][COLOR=#008000]// cbis11 score[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][SIZE=2] cbis12; [/SIZE][SIZE=2][COLOR=#008000]// cbis12 score[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][SIZE=2] cbis36; [/SIZE][SIZE=2][COLOR=#008000]// cbis 36 score[/COLOR][/SIZE]
[SIZE=2]string status; [/SIZE][SIZE=2][COLOR=#008000]// full time or part time status in school[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][SIZE=2] total; [/SIZE][SIZE=2][COLOR=#008000]// total sum of grades[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][SIZE=2] average; [/SIZE][SIZE=2][COLOR=#008000]// total sum of grades divided by total number of grades[/COLOR][/SIZE]
[SIZE=2]string grade; [/SIZE][SIZE=2][COLOR=#008000]// grade letter[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][SIZE=2] gpa; [/SIZE][SIZE=2][COLOR=#008000]// grade point average[/COLOR][/SIZE]
[SIZE=2]string message; [/SIZE][SIZE=2][COLOR=#008000]// grade message, triggered by A or F.[/COLOR][/SIZE]
 
 
 
 
[SIZE=2][COLOR=#008000]// Input[/COLOR][/SIZE]
 
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"What is your ID number? "[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// ask for input id number[/COLOR][/SIZE]
[SIZE=2]cin >> id; [/SIZE][SIZE=2][COLOR=#008000]// get id number[/COLOR][/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"What is your First name? "[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// ask for first name[/COLOR][/SIZE]
[SIZE=2]cin >> fname; [/SIZE][SIZE=2][COLOR=#008000]// get first name[/COLOR][/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"What is your Last name? "[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// ask for last name[/COLOR][/SIZE]
[SIZE=2]cin >> lname; [/SIZE][SIZE=2][COLOR=#008000]// get last name[/COLOR][/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"What is your CBIS 11 Score? "[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// ask for cbis11 score[/COLOR][/SIZE]
[SIZE=2]cin >> cbis11; [/SIZE][SIZE=2][COLOR=#008000]// get score[/COLOR][/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"What is your CBIS 12 Score? "[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// ask for cbis12 score[/COLOR][/SIZE]
[SIZE=2]cin >> cbis12; [/SIZE][SIZE=2][COLOR=#008000]// get score[/COLOR][/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"What is your CBIS 36 Score? "[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// ask for cbis36 score[/COLOR][/SIZE]
[SIZE=2]cin >> cbis36; [/SIZE][SIZE=2][COLOR=#008000]// get score[/COLOR][/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"Press FT for Full Time, or PT for Part Time "[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// ask Fulltime or Parttime[/COLOR][/SIZE]
[SIZE=2]cin >> status; [/SIZE][SIZE=2][COLOR=#008000]// get FT or PT[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2] ( status = [/SIZE][SIZE=2][COLOR=#a31515]"FT"[/COLOR][/SIZE][SIZE=2] )[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"What is your GPA?"[/COLOR][/SIZE][SIZE=2] endl;[/SIZE]
[SIZE=2]cin >> gpa;[/SIZE]
[SIZE=2]}[/SIZE]
 
 
 
 
[SIZE=2][COLOR=#008000]// Process[/COLOR][/SIZE]
 
[SIZE=2]total = ( cbis11 + cbis12 + cbis36 ) ; [/SIZE][SIZE=2][COLOR=#008000]// total class scores is all the scores added up[/COLOR][/SIZE]
[SIZE=2]average = ( total / 3 ) ; [/SIZE][SIZE=2][COLOR=#008000]// average score is all the scores added, then divided by the number of classes.[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2] ( average < 60 )[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2]grade = [/SIZE][SIZE=2][COLOR=#a31515]"F"[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// if grade is less than 60, assign grade F[/COLOR][/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2][COLOR=#0000ff]else[/COLOR][/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2] ( average < 70 )[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2]grade = [/SIZE][SIZE=2][COLOR=#a31515]"D"[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// if grade is less than 70, assign grade D[/COLOR][/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2][COLOR=#0000ff]else[/COLOR][/SIZE]
[SIZE=2]{ [/SIZE]
[SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2] ( average < 80 )[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2]grade = [/SIZE][SIZE=2][COLOR=#a31515]"C"[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// if grade is less than 80, assign grade C[/COLOR][/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2][COLOR=#0000ff]else[/COLOR][/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2] ( average < 90 )[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2]grade = [/SIZE][SIZE=2][COLOR=#a31515]"B"[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// if grade is less than 90, assign grade B[/COLOR][/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2][COLOR=#0000ff]else[/COLOR][/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2] ( average = 90, average > 90 )[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2]grade = [/SIZE][SIZE=2][COLOR=#a31515]"A"[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// if grade is equal to 90, or above 90, assign grade A[/COLOR][/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]}[/SIZE]
 
 
 
[SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2] ( gpa > 3.5 ) [/SIZE][SIZE=2][COLOR=#008000]// if GPA is greater than 3.5, congrats display message.[/COLOR][/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2]message = [/SIZE][SIZE=2][COLOR=#a31515]" \[/COLOR][/SIZE]
[SIZE=2][COLOR=#a31515]*************************************************** endl; \[/COLOR][/SIZE]
[SIZE=2][COLOR=#a31515]* Comments: Congratulations on your achievements! * endl; \[/COLOR][/SIZE]
[SIZE=2][COLOR=#a31515]* You Made The Dean's List!!!! * endl; \[/COLOR][/SIZE]
[SIZE=2][COLOR=#a31515]***************************************************"[/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2] ( gpa < 2 ) [/SIZE][SIZE=2][COLOR=#008000]// if GPA is lower than 2, display warning message.[/COLOR][/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2]message = [/SIZE][SIZE=2][COLOR=#a31515]" \[/COLOR][/SIZE]
[SIZE=2][COLOR=#a31515]*************************************************** endl; \[/COLOR][/SIZE]
[SIZE=2][COLOR=#a31515]* Comments: You need to be working MUCH harder!! * endl; \[/COLOR][/SIZE]
[SIZE=2][COLOR=#a31515]* You are on Academic Probation * endl; \[/COLOR][/SIZE]
[SIZE=2][COLOR=#a31515]***************************************************"[/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2]}[/SIZE]
 
 
 
 
[SIZE=2][COLOR=#008000]// Clear The Console Screen[/COLOR][/SIZE]
 
[SIZE=2]system([/SIZE][SIZE=2][COLOR=#a31515]"cls"[/COLOR][/SIZE][SIZE=2]); [/SIZE][SIZE=2][COLOR=#008000]// clear the screen before displaying results.[/COLOR][/SIZE]
 
 
 
 
[SIZE=2][COLOR=#008000]// Output[/COLOR][/SIZE]
 
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]" ----------------------------------------------------------------------- "[/COLOR][/SIZE][SIZE=2] endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"Student Grading System (SGS)"[/COLOR][/SIZE][SIZE=2] endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"Long Beach City College"[/COLOR][/SIZE][SIZE=2] endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"Author: Alan Rosenquist"[/COLOR][/SIZE][SIZE=2] endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"March 2nd, 2007"[/COLOR][/SIZE][SIZE=2] endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"======================================================================="[/COLOR][/SIZE][SIZE=2] endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"ID #: "[/COLOR][/SIZE][SIZE=2] << id << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"First Name: "[/COLOR][/SIZE][SIZE=2] << fname << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"Last Name: "[/COLOR][/SIZE][SIZE=2] << lname << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"\n"[/COLOR][/SIZE][SIZE=2] endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"Total Score: "[/COLOR][/SIZE][SIZE=2] << total << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"Average Score: "[/COLOR][/SIZE][SIZE=2] << average << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"Grade: "[/COLOR][/SIZE][SIZE=2] << grade << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"Status: "[/COLOR][/SIZE][SIZE=2] << status << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"Semester GPA: "[/COLOR][/SIZE][SIZE=2] << average << endl;[/SIZE]
[SIZE=2]cout << message << endl;[/SIZE]
[SIZE=2]cin >> endl;[/SIZE]
 
[SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][SIZE=2] 0;[/SIZE]
[SIZE=2]}[/SIZE]
 

GEN3RIC

OSNN Senior Addict
Joined
Apr 4, 2005
Messages
634
Dont worry, c++ is hell on your eyes. your solution is in bright red.

Code:
[COLOR=#0000ff]if[/COLOR][SIZE=2] ( status = [/SIZE][SIZE=2][COLOR=#a31515]"FT"[/COLOR][/SIZE][SIZE=2] )[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"What is your GPA?" [/COLOR][COLOR=red][B]<<[/B][/COLOR][/SIZE][SIZE=2] endl;[/SIZE]
[SIZE=2]cin >> gpa;[/SIZE]
[SIZE=2]}[/SIZE]
 

GEN3RIC

OSNN Senior Addict
Joined
Apr 4, 2005
Messages
634
Jeez that didnt even come close to compiling. I am glad I looked at it. This compiles - even though after you insert your GPA it exits the console. so I fixed that. just look over and compare your code and youll see where the errors lie.

Code:
[SIZE=2][COLOR=#0000ff]#include [/COLOR][/SIZE][SIZE=2][COLOR=#a31515]<iostream>[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]#include [/COLOR][/SIZE][SIZE=2][COLOR=#a31515]<string>[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]using [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]namespace[/COLOR][/SIZE][SIZE=2] std;[/SIZE]
 
[SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][SIZE=2] main()[/SIZE]
[SIZE=2]{[/SIZE]
 
 
 
 
[SIZE=2][COLOR=#008000]// Header[/COLOR][/SIZE]
 
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]" \t ****** * * ******* ***** ******* "[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]" \t* * * * * * * "[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]" \t* * * * * ***** * "[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]" \t* * * * * * * * "[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]" \t ****** ****** ******* ****** * "[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]" \t * Program name:"[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]" \t * Date: March 02 2007"[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]" \t * Author: Alan Rosenquist"[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]" \t * Description:"[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]""[/COLOR][/SIZE][SIZE=2]<< endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]""[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
 
 
 
 
[SIZE=2][COLOR=#008000]// Declaration of[/COLOR][/SIZE]
 
[SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][SIZE=2] id; [/SIZE][SIZE=2][COLOR=#008000]// student id number[/COLOR][/SIZE]
[SIZE=2]string fname; [/SIZE][SIZE=2][COLOR=#008000]// students first name[/COLOR][/SIZE]
[SIZE=2]string lname; [/SIZE][SIZE=2][COLOR=#008000]// students last name[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][SIZE=2] cbis11; [/SIZE][SIZE=2][COLOR=#008000]// cbis11 score[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][SIZE=2] cbis12; [/SIZE][SIZE=2][COLOR=#008000]// cbis12 score[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][SIZE=2] cbis36; [/SIZE][SIZE=2][COLOR=#008000]// cbis 36 score[/COLOR][/SIZE]
[SIZE=2]string status; [/SIZE][SIZE=2][COLOR=#008000]// full time or part time status in school[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][SIZE=2] total; [/SIZE][SIZE=2][COLOR=#008000]// total sum of grades[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][SIZE=2] average; [/SIZE][SIZE=2][COLOR=#008000]// total sum of grades divided by total number of grades[/COLOR][/SIZE]
[SIZE=2]string grade; [/SIZE][SIZE=2][COLOR=#008000]// grade letter[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][SIZE=2] gpa; [/SIZE][SIZE=2][COLOR=#008000]// grade point average[/COLOR][/SIZE]
[SIZE=2]string message; [/SIZE][SIZE=2][COLOR=#008000]// grade message, triggered by A or F.[/COLOR][/SIZE]
 
 
 
 
[SIZE=2][COLOR=#008000]// Input[/COLOR][/SIZE]
 
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"What is your ID number? "[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// ask for input id number[/COLOR][/SIZE]
[SIZE=2]cin >> id; [/SIZE][SIZE=2][COLOR=#008000]// get id number[/COLOR][/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"What is your First name? "[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// ask for first name[/COLOR][/SIZE]
[SIZE=2]cin >> fname; [/SIZE][SIZE=2][COLOR=#008000]// get first name[/COLOR][/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"What is your Last name? "[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// ask for last name[/COLOR][/SIZE]
[SIZE=2]cin >> lname; [/SIZE][SIZE=2][COLOR=#008000]// get last name[/COLOR][/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"What is your CBIS 11 Score? "[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// ask for cbis11 score[/COLOR][/SIZE]
[SIZE=2]cin >> cbis11; [/SIZE][SIZE=2][COLOR=#008000]// get score[/COLOR][/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"What is your CBIS 12 Score? "[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// ask for cbis12 score[/COLOR][/SIZE]
[SIZE=2]cin >> cbis12; [/SIZE][SIZE=2][COLOR=#008000]// get score[/COLOR][/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"What is your CBIS 36 Score? "[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// ask for cbis36 score[/COLOR][/SIZE]
[SIZE=2]cin >> cbis36; [/SIZE][SIZE=2][COLOR=#008000]// get score[/COLOR][/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"Press FT for Full Time, or PT for Part Time "[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// ask Fulltime or Parttime[/COLOR][/SIZE]
[SIZE=2]cin >> status; [/SIZE][SIZE=2][COLOR=#008000]// get FT or PT[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2] (status == [/SIZE][SIZE=2][COLOR=#a31515]"FT"[/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"What is your GPA?"[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cin >> gpa;[/SIZE]
[SIZE=2]}[/SIZE]
 
 
 
 
[SIZE=2][COLOR=#008000]// Process[/COLOR][/SIZE]
 
[SIZE=2]total = ( cbis11 + cbis12 + cbis36 ) ; [/SIZE][SIZE=2][COLOR=#008000]// total class scores is all the scores added up[/COLOR][/SIZE]
[SIZE=2]average = ( total / 3 ) ; [/SIZE][SIZE=2][COLOR=#008000]// average score is all the scores added, then divided by the number of classes.[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2] ( average < 60 ) {[/SIZE]
[SIZE=2]grade = [/SIZE][SIZE=2][COLOR=#a31515]"F"[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// if grade is less than 60, assign grade F[/COLOR][/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2][COLOR=#0000ff]else[/COLOR][/SIZE][SIZE=2] {[/SIZE]
[SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2] ( average < 70 ) {[/SIZE]
[SIZE=2]grade = [/SIZE][SIZE=2][COLOR=#a31515]"D"[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// if grade is less than 70, assign grade D[/COLOR][/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2][COLOR=#0000ff]else[/COLOR][/SIZE][SIZE=2] { [/SIZE]
[SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2] ( average < 80 ) {[/SIZE]
[SIZE=2]grade = [/SIZE][SIZE=2][COLOR=#a31515]"C"[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// if grade is less than 80, assign grade C[/COLOR][/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2][COLOR=#0000ff]else[/COLOR][/SIZE][SIZE=2] {[/SIZE]
[SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2] ( average < 90 ) {[/SIZE]
[SIZE=2]grade = [/SIZE][SIZE=2][COLOR=#a31515]"B"[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// if grade is less than 90, assign grade B[/COLOR][/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2][COLOR=#0000ff]else[/COLOR][/SIZE][SIZE=2] {[/SIZE]
[SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2] ( average = 90, average > 90 ) {[/SIZE]
[SIZE=2]grade = [/SIZE][SIZE=2][COLOR=#a31515]"A"[/COLOR][/SIZE][SIZE=2] ; [/SIZE][SIZE=2][COLOR=#008000]// if grade is equal to 90, or above 90, assign grade A[/COLOR][/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]}[/SIZE]
 
[SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2] ( gpa > 3.5 ) [/SIZE][SIZE=2][COLOR=#008000]// if GPA is greater than 3.5, congrats display message.[/COLOR][/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2]message = [/SIZE][SIZE=2][COLOR=#a31515]" \[/COLOR][/SIZE]
[SIZE=2][COLOR=#a31515]***************************************************\n \[/COLOR][/SIZE]
[SIZE=2][COLOR=#a31515]* Comments: Congratulations on your achievements! *\n \[/COLOR][/SIZE]
[SIZE=2][COLOR=#a31515]* You Made The Dean's List!!!! *\n \[/COLOR][/SIZE]
[SIZE=2][COLOR=#a31515]***************************************************"[/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2] ( gpa < 2 ) [/SIZE][SIZE=2][COLOR=#008000]// if GPA is lower than 2, display warning message.[/COLOR][/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2]message = [/SIZE][SIZE=2][COLOR=#a31515]" \[/COLOR][/SIZE]
[SIZE=2][COLOR=#a31515]***************************************************\n\[/COLOR][/SIZE]
[SIZE=2][COLOR=#a31515]* Comments: You need to be working MUCH harder!! *\n\[/COLOR][/SIZE]
[SIZE=2][COLOR=#a31515]* You are on Academic Probation *\n \[/COLOR][/SIZE]
[SIZE=2][COLOR=#a31515]***************************************************"[/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2]}[/SIZE]
 
 
 
 
[SIZE=2][COLOR=#008000]// Clear The Console Screen[/COLOR][/SIZE]
 
[SIZE=2]system([/SIZE][SIZE=2][COLOR=#a31515]"cls"[/COLOR][/SIZE][SIZE=2]); [/SIZE][SIZE=2][COLOR=#008000]// clear the screen before displaying results.[/COLOR][/SIZE]
 
 
 
 
[SIZE=2][COLOR=#008000]// Output[/COLOR][/SIZE]
 
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]" ----------------------------------------------------------------------- "[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"Student Grading System (SGS)"[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"Long Beach City College"[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"Author: Alan Rosenquist"[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"March 2nd, 2007"[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"======================================================================="[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"ID #: "[/COLOR][/SIZE][SIZE=2] << id << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"First Name: "[/COLOR][/SIZE][SIZE=2] << fname << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"Last Name: "[/COLOR][/SIZE][SIZE=2] << lname << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"\n"[/COLOR][/SIZE][SIZE=2] << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"Total Score: "[/COLOR][/SIZE][SIZE=2] << total << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"Average Score: "[/COLOR][/SIZE][SIZE=2] << average << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"Grade: "[/COLOR][/SIZE][SIZE=2] << grade << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"Status: "[/COLOR][/SIZE][SIZE=2] << status << endl;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"Semester GPA: "[/COLOR][/SIZE][SIZE=2] << average << endl;[/SIZE]
[SIZE=2]cout << message << endl;[/SIZE]
[SIZE=2]cout << endl;[/SIZE]
[SIZE=2]string quit;[/SIZE]
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515]"Quit? Y/N\t"[/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2]cin >> quit;[/SIZE]
[SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2] (quit == [/SIZE][SIZE=2][COLOR=#a31515]"Y"[/COLOR][/SIZE][SIZE=2]) {[/SIZE]
[SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][SIZE=2] 0; [/SIZE]
[SIZE=2]} [/SIZE]
[SIZE=2][COLOR=#0000ff]else[/COLOR][/SIZE][SIZE=2] {[/SIZE]
[SIZE=2]system([/SIZE][SIZE=2][COLOR=#a31515]"cls"[/COLOR][/SIZE][SIZE=2]);[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]}[/SIZE]
 

X-Istence

*
Political User
Joined
Dec 5, 2001
Messages
6,498
GEN3RIC: Don't give out full answers, people need to learn to read compiler errors to figure out what they did wrong. C++ is very easy to read properly indented and properly written.

That one is a simple error that the compiler caught, and the human should have looked at line 96, look at endl, and looked to the front and to the back of it, and then figured out what is wrong. Compiler gave a clear warning!
 

dubstar

format c:
Joined
Dec 3, 2002
Messages
1,357
thanks guys, i really appreciate it.

x-istence: if it said "missing closing insertion operator" that would have been obvious, but for someone starting out, who adds code to they made a day ago, its easy to forget things.
 
Last edited:

GEN3RIC

OSNN Senior Addict
Joined
Apr 4, 2005
Messages
634
I gave it to him because I have seen beginners struggle over the 38 errors I found. It would have taken me 2 days to elaborate each error cryptically so he could find them himself.

I debated on not fixing it but telling him what's wrong, but its less helpful than you'd think.

I am sure he appreciates what I did and will learn by his corrected example.
 

GEN3RIC

OSNN Senior Addict
Joined
Apr 4, 2005
Messages
634
OH, and my opinion is that C++ is a mess to read. A lot of single character variables and less than verbose syntax makes it one of the hardest languages - save Java - for a beginner to read.
 

X-Istence

*
Political User
Joined
Dec 5, 2001
Messages
6,498
OH, and my opinion is that C++ is a mess to read. A lot of single character variables and less than verbose syntax makes it one of the hardest languages - save Java - for a beginner to read.
Single character variables?

Code:
int i;
is as valid as

Code:
int iterator;
using single character variables is up to the programmer and has nothing to do with the language. Likewise much of the shorthand that is being used with the insertion operator can be done in a different way as well. Insertion operators are just in general easier to use for the programmer.

Dubstar: How is the compiler to know what you want to do with the variable endl? For all it knows you want that as a separate segment of code. It can't guess what you as the programmer would want to do on that line. Remember the compiler can't deduce that you want to do something like we humans can. Now, that error is very helpful, as it is asking you to please put a semicolon on that line before the endl, if you went to the line to go make the compiler happy (thus placing a semicolon) you would have caught your own mistake easily.

Trust me, get familiar with compiler errors, you will be dependent on them to write good code. Especially warnings it throws should be looked at under a magnifying glass, and only then should warnings get ignored if there is no way around it.
 

dubstar

format c:
Joined
Dec 3, 2002
Messages
1,357
i refer back to this once in a while, helps a lot.

thanks again!
 

Sazar

F@H - Is it in you?
Staff member
Political User
Joined
Apr 12, 2002
Messages
14,905
GEN3RIC: Don't give out full answers, people need to learn to read compiler errors to figure out what they did wrong. C++ is very easy to read properly indented and properly written.

That one is a simple error that the compiler caught, and the human should have looked at line 96, look at endl, and looked to the front and to the back of it, and then figured out what is wrong. Compiler gave a clear warning!
I agree and disagree :(

I happen to be partially color blind and believe me when I tell you, some of the color-coded errors simply slip my notice :(
 

dubstar

format c:
Joined
Dec 3, 2002
Messages
1,357
color-coded? aw, now i know why my friend said this was a blue site and not a grey one.
 

X-Istence

*
Political User
Joined
Dec 5, 2001
Messages
6,498
I agree and disagree :(

I happen to be partially color blind and believe me when I tell you, some of the color-coded errors simply slip my notice :(
I personally don't have a syntax highlighter when I program. Everything is black and white. This also, once again was not something that would have been caught by syntax highlighting, so it does not pertain to why I said don't give out full answers.
 

Members online

Latest profile posts

Perris Calderon wrote on Electronic Punk's profile.
Hey ep!

All good with me, applying for microsoft mvp right now, should have done this a while ago.

Notifications don't work, I only found your response by comming back to hunt up some threads, if you want, give me your email address so we can keep in touch easier, mine is perriscalderon at gmail
Perris Calderon wrote on Electronic Punk's profile.
Ep, glad to see you come back and tidy up...did want to ask a one day favor, I want to enhance my resume , was hoping you could make me administrator for a day, if so, take me right off since I won't be here to do anything, and don't know the slightest about the board, but it would be nice putting "served administrator osnn", if can do, THANKS

Been running around Quora lately, luv it there https://tinyurl.com/ycpxl
Electronic Punk wrote on Perris Calderon's profile.
All good still mate?
Hello, is there anybody in there? Just nod if you can hear me ...

Forum statistics

Threads
61,974
Messages
673,294
Members
89,040
Latest member
PHMachelle