I need urgent help with a question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I need urgent help with a question

Two students, A and B, in csc 102 compared their grades (0 <= <= 5_ in the first 3 quizzes . Grades for A: a1, a2, a3 Grades for B: b1, b2, b3 If a1>b1 then A receives one point If a1<b1, then B receives one point If a1=b1 then neither student receives a point Given the grades of A and B, you are asked to write a C++ program to print the point totals of the two students. Input Format: The first line contains three space-seperated integers: a1, a2, a3 The second line contains three space-separated integers: b1, b2, b3 Output Format: Print space separated integers denoting the respective point totals earned A and B Instructions: Run your program using different sets of input to validate it. Provide 1) the C++ program developed, 2) inputs used, and 3) output - So this is a intro to c++ class and I asked a friend who mentioned something called “adding a counter” but I have no idea what that is because we never covered it, so what is the simplest way to do this?

15th Oct 2018, 4:54 AM
chaudhry saleem
chaudhry saleem - avatar
1 Answer
0
Hey, thanks alot, but where would i put those in the code? #include <iostream> #include <stdio.h> #include <math.h> #include <stdbool.h> #include <string> using namespace std; int main () { int a1= 5; int a2= 0; int a3= 5; int b1= 3; int b2= 2; int b3= 4; if(a1<b1){ cout << "Student B gets one point \n"; } else{ cout << "Student A gets one point \n"; } if(a2<b2){ cout << "Student B gets one point \n"; } else{ cout << "Student A gets one point \n"; } if(a3<b3){ cout << "Student B gets one point \n"; } else{ cout << "Student A gets one point \n"; } cout<< a1<<" "<<a2<<" "<<a3 <<endl; cout<< b1<<" "<<b2<<" "<<b3 <<endl; return 0; } This is the code i have, i literally learned all this today starting from complete scratch so i am pretty new to this if thats a way to say it lol.
15th Oct 2018, 5:23 AM
chaudhry saleem
chaudhry saleem - avatar