Computer Science Canada Problems with program |
Author: | aliveiswell [ Tue Dec 16, 2003 11:04 pm ] |
Post subject: | Problems with program |
We were doing this in class in Turing and I wanted to try it in C++ but it has a lot of problems and I can't figure any of them out. They may be stupid...: #include<iostream.h> int numberMarks; int counter; int counter2; void main() { // Description of program cout << "This program will take marks from a report card and output them." << endl; cout << "How many marks are you going to input: "; cin >> numberMarks; // Declare arrays for for loop char subject[numberMarks]; int mark[numberMarks]; int perfectMark[numberMarks]; // For loop - asks for subject and marks for (counter=0; counter<numberMarks; counter+1) { cout << "What subject is this mark for?"; cin >> subject[counter]; cout << "What mark did you get?"; cin >> mark[counter]; cout << "What is the mark out of?"; cin >> perfectMark[counter]; } cout << "Your marks:" << endl; // For loop - outputs all marks for (counter=0; counter<numberMarks; counter+1) { cout << "Subject: " << subject[counter2] << endl; cout << "Mark: " << mark[numberMarks] << "/" << perfectMark[numberMarks] << endl; } return 0; } I was using vc++ |
Author: | Tony [ Tue Dec 16, 2003 11:19 pm ] |
Post subject: | |
isn't it counter++, not counter+1 ![]() |
Author: | wtd [ Mon Feb 09, 2004 1:39 pm ] | ||
Post subject: | |||
Just because I'm bored...
|
Author: | Andy [ Mon Feb 09, 2004 5:00 pm ] |
Post subject: | |
ya u have to do counter+=1 or counter++ |