I dunno what I did wrong with my program but I am getting a bunch of errors is converting letter to number...could anyone take a look....
#include <iostream>
#include <string>
using namespace std;
string Get_Name_and_Num_Classes(string name, int classes);
double Calculate_GPA(char grade, int count);
void Get_Letter_Grade(char grade);
double Convert_Let_to_Num();
void Print_Results(string name, double gpa);
int main()
{
string name, xxx;
int count = 1;
int classes;
char grade;
double gpa;
cout << "Programmed by Jim Johnson";
cout << endl << endl << "Type xxx for the name to Exit";
do
{
cout << endl << endl << "Enter the student's last name: ";
name = Get_Name_and_Num_Classes(name, classes);
while (name != "xxx")
{
cout << endl << "How many classes taken: ";
classes = Get_Name_and_Num_Classes(name, classes);
}while (count <= classes)
cout << endl << endl << "Enter letter grade " << count << ": ";
grade = Get_Letter_Grade(grade);
count ++;
gpa = Calculate_GPA(grade, count);
Print_Results(name, gpa);
}while (name != "xxx");
return 0;
}
void Get_Letter_Grade(char grade)
{
cin >> grade;
}
double Calculate_GPA()
{
int total_grades;
double gpa;
total_grades =
return gpa;
}
string Convert_Let_to_Num(char grade)
{
int number;
if ((char == 'a') || (char == 'A'));
{
number = 4;
}
if ((char == 'b') || (char == 'B'));
{
number = 3;
}
if ((char == 'c') || (char == 'C'));
{
number = 2;
}
if ((char == 'd') || (char == 'D'));
{
number = 1;
}
if ((char == 'f') || (char == 'F'));
{
number = 0;
}
return (number);
}
void Print_Results(string name, double gpa)
{
cout << "Student " << name << " has a semester GPA of " << gpa;
}
all my errors but just worried about convert letter to number(i think it must be something small so thinkin outside the box)...if anyone has ideas please let me know.....
1>------ Build started: Project: Project 04, Configuration: Debug Win32 ------
1>Compiling...
1>P04.cpp
1>c:\documents and settings\don & diane kruep\desktop\project 04\p04.cpp(33) : error C2440: '=' : cannot convert from 'std::string' to 'int'
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>c:\documents and settings\don & diane kruep\desktop\project 04\p04.cpp(38) : error C2440: '=' : cannot convert from 'void' to 'char'
1> Expressions of type void cannot be converted to other types
1>c:\documents and settings\don & diane kruep\desktop\project 04\p04.cpp(64) : error C2059: syntax error : 'return'
1>c:\documents and settings\don & diane kruep\desktop\project 04\p04.cpp(71) : error C2143: syntax error : missing ')' before '=='
1>c:\documents and settings\don & diane kruep\desktop\project 04\p04.cpp(71) : error C2059: syntax error : '=='
1>c:\documents and settings\don & diane kruep\desktop\project 04\p04.cpp(71) : error C2059: syntax error : ')'
1>c:\documents and settings\don & diane kruep\desktop\project 04\p04.cpp(75) : error C2143: syntax error : missing ')' before '=='
1>c:\documents and settings\don & diane kruep\desktop\project 04\p04.cpp(75) : error C2059: syntax error : '=='
1>c:\documents and settings\don & diane kruep\desktop\project 04\p04.cpp(75) : error C2059: syntax error : ')'
1>c:\documents and settings\don & diane kruep\desktop\project 04\p04.cpp(79) : error C2143: syntax error : missing ')' before '=='
1>c:\documents and settings\don & diane kruep\desktop\project 04\p04.cpp(79) : error C2059: syntax error : '=='
1>c:\documents and settings\don & diane kruep\desktop\project 04\p04.cpp(79) : error C2059: syntax error : ')'
1>c:\documents and settings\don & diane kruep\desktop\project 04\p04.cpp(83) : error C2143: syntax error : missing ')' before '=='
1>c:\documents and settings\don & diane kruep\desktop\project 04\p04.cpp(83) : error C2059: syntax error : '=='
1>c:\documents and settings\don & diane kruep\desktop\project 04\p04.cpp(83) : error C2059: syntax error : ')'
1>c:\documents and settings\don & diane kruep\desktop\project 04\p04.cpp(87) : error C2143: syntax error : missing ')' before '=='
1>c:\documents and settings\don & diane kruep\desktop\project 04\p04.cpp(87) : error C2059: syntax error : '=='
1>c:\documents and settings\don & diane kruep\desktop\project 04\p04.cpp(87) : error C2059: syntax error : ')'
1>c:\documents and settings\don & diane kruep\desktop\project 04\p04.cpp(91) : error C2664: 'std::basic_string<_Elem,_Traits,_Ax>::basic_string(std::basic_string<_Elem,_Traits,_Ax>::_Has_debug_it)' : cannot convert parameter 1 from 'int' to 'std::basic_string<_Elem,_Traits,_Ax>::_Has_debug_it'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> Constructor for struct 'std::basic_string<_Elem,_Traits,_Ax>::_Has_debug_it' is declared 'explicit'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1>Build log was saved at "file://c:\Documents and Settings\Don & Diane Kruep\Desktop\Project 04\Debug\BuildLog.htm"
1>Project 04 - 19 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
instructions for the functions......
• Convert_Let_to_Num – Takes in a letter grade and converts it to its number equivalent (A–4, B–3, C–2, D–1, F–0) It should return the number equivalent