For Looping problems

For my program I have to ask how many programs the user has taken then ask the individual score and max possible score for that number of programs. So if the user has submitted 5 programs then the output must look like this:

Enter the number of programs that have been completed: 5

Enter your score for program 1: 5
Enter the maximum possible score for program 1: 5

Enter your score for program 2: 25
Enter the maximum possible score for program 2: 25

Enter your score for program 3: 72
Enter the maximum possible score for program 3: 75

Enter your score for program 4: 92
Enter the maximum possible score for program 4: 100

Enter your score for program 5: 100
Enter the maximum possible score for program 5: 100


my problem is that I'm having a little trouble with the for looping, and outputting directions for the user as well. But here's what I got so far.

1
2
3
4
5
6
7
8
9
10
  //Asking user about program scores
    
    cout<< "Please enter the number of Programs ";
    cin >> programnumber;
    
    for( int i = 0; i < programnumber; i =i+1)
    { cout << "Please enter score for Program" programnumber;
        cin>> totalprogrampoints;
        cout << "Please enter total possible points for Program" programnumber;
        cin >> totalprogrampointsavailable;} 
What you have:

cout << "Please enter score for Program" programnumber;

What you meant to have:

cout << "Please enter score for Program" << programnumber << ": ";
Okay so I replaced it with what you had, but now I'm having when there is more than one program, how do keep adding the totals to the totalprogrampoints, and the running total?
Last edited on
Input into temporary variables and then add them to the running totals. Don't input into the running totals.
try adding the integer to another integer and outputit as the first int
Ex:
1
2
3
4
5
6
7
8
9
10
#include <iostream>
using namespace std;
int main
{
cout << a << endl;
int a=1;
int b=5;
a=b+a;
cout << a;
}
Okay thanks everyone, finally got it.
Topic archived. No new replies allowed.