>credit>>LG; if (LG == "A") { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "< Download presentation Presentation is loading. Please wait. Published byShannon Dickason
Modified over 10 years ago
1
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; string LG; while ( i <= 2) { cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl;
2
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; _i_ QP string LG; 1 while ( i <= 2) { cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl;
3
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; _i_ QPcredit totCredit string LG; 1 0.0 while ( i <= 2) { cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl;
4
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; _i_ QPcredit totCredit num string LG; 1 0.0 0.0 while ( i <= 2) { cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl;
5
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; _i_ QPcredit totCredit num LG string LG; 1 0.0 0.0 while ( i <= 2) { cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl;
6
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; _i_ QPcredit totCredit num LG string LG; 1 0.0 0.0 while ( i <= 2) //true { cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl;
7
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; _i_ QPcredit totCredit num LG string LG; 1 0.0 0.0 while ( i <= 2) //true { cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl; Class # 1 credit Letter Grade?
8
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; _i_ QPcredit totCredit num LG string LG; 1 4 0.0 0.0 “B” while ( i <= 2) //true { cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl; Class # 1 credit Letter Grade? 4 B
9
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; _i_ QPcredit totCredit num LG string LG; 1 4 0.0 0.0 “B” while ( i <= 2) //true { cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") //false { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl; Class # 1 credit Letter Grade? 4 B
10
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; _i_ QPcredit totCredit num LG string LG; 1 3 4 0.0 0.0 “B” while ( i <= 2) //true { cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") //false { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl; Class # 1 credit Letter Grade? 4 B
11
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; _i_ QPcredit totCredit num LG string LG; 1 3 4 0.0 0.0 “B” while ( i <= 2) //true 4.0 { cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") //false { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl; Class # 1 credit Letter Grade? 4 B
12
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; _i_ QPcredit totCredit num LG string LG; 1 3 4 0.0 0.0 “B” while ( i <= 2) //true 4.0 12.0 { cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") //false { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl; Class # 1 credit Letter Grade? 4 B
13
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; _i_ QPcredit totCredit num LG string LG; 1 3 4 0.0 0.0 “B” while ( i <= 2) // 2 4.0 12.0 { cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") // { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl; Class # 1 credit Letter Grade? 4 B
14
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; _i_ QPcredit totCredit num LG string LG; 1 3 4 0.0 0.0 “B” while ( i <= 2) // true 2 4.0 12.0 { cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl; Class # 1 credit Letter Grade? 4 B
15
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; _i_ QPcredit totCredit num LG string LG; 1 3 4 0.0 0.0 “B” while ( i <= 2) // true 2 4.0 12.0 { cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl; Class # 1 credit Letter Grade? 4 B Class # 2 credit Letter Grade?
16
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; _i_ QPcredit totCredit num LG string LG; 1 3 4 0.0 0.0 “B” while ( i <= 2) // true 2 3 4.0 12.0 ”A” { cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl; Class # 1 credit Letter Grade? 4 B Class # 2 credit Letter Grade? 3 A
17
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; _i_ QPcredit totCredit num LG string LG; 1 3 4 0.0 0.0 “B” while ( i <= 2) // true 2 3 4.0 12.0 ”A” { cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") // true { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl; Class # 1 credit Letter Grade? 4 B Class # 2 credit Letter Grade? 3 A
18
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; _i_ QPcredit totCredit num LG string LG; 1 3 4 0.0 0.0 “B” while ( i <= 2) // true 2 4 3 4.0 12.0 ”A” { cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") // true { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl; Class # 1 credit Letter Grade? 4 B Class # 2 credit Letter Grade? 3 A
19
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; _i_ QPcredit totCredit num LG string LG; 1 3 4 0.0 0.0 “B” while ( i <= 2) // true 2 4 3 4.0 12.0 ”A” { 7.0 cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") // true { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl; Class # 1 credit Letter Grade? 4 B Class # 2 credit Letter Grade? 3 A
20
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; _i_ QPcredit totCredit num LG string LG; 1 3 4 0.0 0.0 “B” while ( i <= 2) // true 2 4 3 4.0 12.0 ”A” { 7.0 24.0 cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") // true { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl; Class # 1 credit Letter Grade? 4 B Class # 2 credit Letter Grade? 3 A
21
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; _i_ QPcredit totCredit num LG string LG; 1 3 4 0.0 0.0 “B” while ( i <= 2) // 2 4 3 4.0 12.0 ”A” { 3 7.0 24.0 cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") // { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl; Class # 1 credit Letter Grade? 4 B Class # 2 credit Letter Grade? 3 A
22
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; _i_ QPcredit totCredit num LG string LG; 1 3 4 0.0 0.0 “B” while ( i <= 2) // false 2 4 3 4.0 12.0 ”A” { 3 7.0 24.0 cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") // { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl; Class # 1 credit Letter Grade? 4 B Class # 2 credit Letter Grade? 3 A
23
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; GPA _i_ QPcredit totCredit num LG string LG; 3.43 1 3 4 0.0 0.0 “B” while ( i <= 2) // false 2 4 3 4.0 12.0 ”A” { 3 7.0 24.0 cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") // { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl; Class # 1 credit Letter Grade? 4 B Class # 2 credit Letter Grade? 3 A
24
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; GPA _i_ QPcredit totCredit num LG string LG; 3.43 1 3 4 0.0 0.0 “B” while ( i <= 2) // false 2 4 3 4.0 12.0 ”A” { 3 7.0 24.0 cout<<"Class # "<<i<<"credit Letter Grade? "; cin >>credit>>LG; if (LG == "A") // { QP = 4; } else { QP = 3; } totCredit = totCredit + credit; num = num + credit * QP; i = i + 1; } double GPA = num / totCredit; cout<<"GPA = "<<GPA<<endl; Class # 1 credit Letter Grade? 4 B Class # 2 credit Letter Grade? 3 A GPA= 3.42857
Similar presentations © 2024 SlidePlayer.com. Inc. Log in
What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; string LG;
Similar presentations
Presentation on theme: "What is output line of the following C++ code? Please trace int i = 1, QP; DATA: 4, B, 3, A double credit, totCredit=0.0; double num = 0.0; string LG;"— Presentation transcript:
Similar presentations
All rights reserved.