0
Can anyone correct the following code?
I need to automatically take a name from std array and put it one cout below the first loop; ANYONE HELP #include <iostream> using namespace std; main() { //Two dimentional Array with nested for loops string stds[2][3] = { {"Ahmad"}, {"Mahmood"} }; int marks[2][3]; int a, j, k, l; for (a=1; a<=2; a++){ cout<<stds[a]<<endl; for(j=1; j<=3; j++){ cout<<"Enter Marks "; cin>>marks[a][j]; } } cout<<endl; }
1 Answer
+ 5
1) There is no need to use 2 dimensional array for just 2 strings.
2) main() should be int main()
3) Array index starts from 0 not from 1.