infinite while loop

I'm writing a program to demonstrate the use of structures. here it is:

#include<iostream>
using namespace std;

struct courseRecord {
int myTests[10][5];
char name[20];
char day[20];
int courseid;
};

struct courseRecord college[100];

int main ()
{
int a,b,c;

cout << "\n Enter the course data: \n" << "------------------";
cout << "\n How many courses?";
cin>> c;


for (a = 1;a <= c; a++)
{
do {
cout << "\n What is the name of course " << a << " ? ";
cin >> college[a].name;
cout << "\n What is the id number for this course?";
cin >> college[a].courseid;
cout << "\n What day does this course meet?";
cin >> college[a].day;
cout << "\n How many tests have you taken in this course?";
cin >> b;

for ( int test=1; test<= b ;test++)
{
cout<< "\n Grade on test "<<test<<"?";
cin>> college[a].myTests[a][test];
}
}
while (a <= c);
}

cout<< "\n\n Enter the ID for the course you want to view: ";
cin>>a;
cout<< "\n Course: " << college[a].name;
cout<< "\n Day of course: " << college[a].day;
cout<< "\n Your test results: ";

for (int x = 1; x <= 5; x++){
cout<< college[a].myTests[a][x];
}

cout<< "\n\n";

system("pause");
return 0;
}
the issue here is that it keeps asking for the information in course 1 over and over again without moving to the part where the name day and course test results are printed. how would i go about fixing this?
Please put you code inside of a codeblock so we can read it ;)
Get rid of the do/while loop.

So then you would just have:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
for (a = 1; a <= c; a++)
{
    cout << "\n What is the name of course " << a << " ? ";
    cin >> college[a].name;
    cout << "\n What is the id number for this course?";
    cin >> college[a].courseid;
    cout << "\n What day does this course meet?";
    cin >> college[a].day;
    cout << "\n How many tests have you taken in this course?";
    cin >> b;

    for ( int test=1; test<= b ; test++)
    {
        cout<< "\n Grade on test "<<test<<"?";
        cin>> college[a].myTests[a][test];
    }
}
Topic archived. No new replies allowed.