1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#include<iostream>
std::string myarray[3][10] = {{"1","2","3","4","5","a","b","c","d","e"},
{"f","g","h","i","j","k","l","m","n","s",},
{" "," "," "," "," "," "," "," "," "," ",}};
void displaygrid();
using namespace std;
int main (){
int size=0
string add; //
displaygrid();
cout<<"==========================================" <<endl;
cout<<"insert element: ";
cin>>add;
myarray[2][size] = add;
cout<<"Insert Successful!" <<endl;
size=size+1;
displaygrid();
}
void displaygrid(){
cout<<endl;
for(int z = 0; z<10; z++){
cout<<" "<<z;
}
cout<<endl;
for(int x = 0; x<3; x++){
cout<<x;
for(int y = 0; y<10; y++){
cout<<" " <<myarray[x][y] <<" ";
}
cout<<endl;
}
}
|