Multi dimentional Arrays.
Sep 8, 2014 at 6:56pm UTC
Write a program to enter data into a table and display on the screen in tabular form. Please check my code below. I want to know where are the errors.
Thanks in advance.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#include<iostream>
using namespace std;
int main()
{
int table[3][4];
int r,c,i;
r=c=0;
while (r<=2)
{
for (r=0;r<5;r++)
cout<<"enter values in rows" <<endl;
cin>>table[r][c];
}
r++
for (i=0;i<5;i++)
{
cout<<table[r][c]<<"\t" ;
cout<<endl;
}
getch();
}
Sep 8, 2014 at 6:59pm UTC
shoqi wrote:I want to know where are the errors.
Did you try compiling it?
http://coliru.stacked-crooked.com/a/5ac930692a3f2baf main.cpp:15:8: error: expected ';' after expression
r++
^
;
main.cpp:21:5: error: use of undeclared identifier 'getch'
getch();
^
2 errors generated.
Also, line 12 is not part of the for loop.
Sep 8, 2014 at 7:07pm UTC
Yes I tried. I am compiling in turbo c++ v4.5. Putted semicolon after r++ still getting errors.
Thanks.
Sep 8, 2014 at 8:03pm UTC
Could you copy and paste the exact errors you are getting?
Topic archived. No new replies allowed.