QuestionQuestion Computer Science – Intro to C++ Problem style=”color:rgb(0,0,0);”>You be prompting a student for grades and credits for courses taken. From that, you will calculate a GPA. am?
Question
Computer Science – Intro to C++ Problem
style=”color:rgb(0,0,0);”>You be prompting a student for grades and credits for courses taken. From that, you will calculate a GPA. This site: http://www.back2college.com/gpa.htm shows you how to calculate a GPA. Keep prompting the student if they want to add more courses. IMPORTANT NOTES! The course name is prompted for, but nothing is done with it.We are just using the grades A, B, C, D, and F so you won’t have to do so much typing!You will need to use the “set precision” command Set it to “fixed” and “2”.You will need to use the “cin.ignore()” function as discussed earlier in the course.
This is what I have thus far:
#include <iostream>#include <string> using namespace std; string course;int credits;string grade;string answer; int main() { cout << “Enter a course name: “; getline(cin,course); cout << course; cout << endl; cout << “Enter number of credits: “; cin >> credits; cout << credits; cout << endl; cout << “Enter you grade (A, B, C, D, F): “; cin >> grade; cout << grade; cout << endl; cout << “Continue (‘Yes’ or ‘No’)? “; cin >> answer; cout << answer; cout << endl; return 0; }
Do I need a while loop to ask questions, and I am assuming a:
if(grade == “A”){gradePoint = credit * 4;}
What about the “set precision” to a fixed 2 value and “cin.ignore()” in the program?
QuestionQuestion Computer Science – Intro to C++ Problem style=”color:rgb(0,0,0);”>You be prompting a student for grades and credits for courses taken. From that, you will calculate a GPA. This site: http://www.back2college.com/gpa.htm shows you how to calculate a GPA. Keep prompting the student if they want to add more courses. IMPORTANT NOTES! The course name is prompted for, but nothing is done with it. We are just using the grades A, B, C, D, and F so you won’t have to do so much typing! You will need to use the “set precision” command Set it to “fixed” and “2”. You will need to use the “cin.ignore()” function as discussed earlier in the course. This is what I have thus far: #include #include using namespace std; string course; int credits; string grade; string answer; int main() { cout << “Enter a course name: “; getline(cin,course); cout << course; cout << endl; cout <> credits; cout << credits; cout << endl; cout <> grade; cout << grade; cout << endl; cout <> answer; cout << answer; cout <You be prompting a student for grades and credits for courses taken. From that, you will calculate a GPA. This site: http://www.back2college.com/gpa.htm shows you how to calculate a GPA. Keep prompting the student if they want to add more courses. IMPORTANT NOTES! The course name is prompted for, but nothing is done with it. We are just using the grades A, B, C, D, and F so you won’t have to do so much typing! You will need to use the “set precision” command Set it to “fixed” and “2”. You will need to use the “cin.ignore()” function as discussed earlier in the course. This is what I have thus far: #include #include using namespace std; string course; int credits; string grade; string answer; int main() { cout << “Enter a course name: “; getline(cin,course); cout << course; cout << endl; cout <> credits; cout << credits; cout << endl; cout <> grade; cout << grade; cout << endl; cout <> answer; cout << answer; cout << endl; return 0; } Do I need a while loop to ask questions, and I am assuming a: if(grade == “A”){ gradePoint = credit * 4; } What about the “set precision” to a fixed 2 value and “cin.ignore()” in the program?