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 46 47 48 49 50 51 52 53 54 55 56 57 58
|
#include<iostream>
#include<string>
std::string myarray[3][6] = {{"a","b","c","d","e","f",},
{"g","h","i","j","k","l",},
{" "," "," "," "," "," ",}}; //i made some allowance so that i can insert/delete
std::string myarray2[3][6];
void display();
using namespace std;
int main(){
int xdelete;
int ydelete;
display();
cout<<"\nDelete character" <<endl;
cout<<"enter position x: ";
cin>>xdelete;
cout<<"enter position y: ";
cin>>ydelete;
for(int x = xdelete; x<2; x++){
for(int y = ydelete ;y<6;y++){
myarray[x][y] = myarray[x][y+1];
}
}
display();
}
//display
void display(){
cout<<endl;
for(int z = 0; z<6; z++){
cout<<" "<<z;
}
cout<<endl;
for(int x = 0; x<2; x++){
cout<<x <<"|";
for(int y = 0; y<6; y++){
cout<<" " <<myarray[x][y] <<" ";
}
cout<<endl;
}
}
|