Instead of using a 1x1 array, why not just multiply the two numbers and have a single array? Its the same thing in terms of what the compiler reads. And it looks neater than having the whole
[x][x]
code working.
Just my opinion. Anyways, is basicinfotitle a string? A character array? What is it you're doing? Is bookinfo a 2 dimensional character array?
When I said 1 x 1 array, I meant to say single dimension array. What his syntax looks to be is a double dimension array. I was just leading to the idea that it doesn't need to be a double dimension array and that a single D array would work just the same.
#include "hw.h"
#include <string>
#include <iostream>
usingnamespace std;
string bookinfo[2][3];
int k;
string changes;
int main()
{
bstore basicinfo;
string basicinfotitle;
string basicinfoauthor;
string basicinfoprice;
int j;
for(j=0;j<2;j++){
basicinfotitle=basicinfo.title();
basicinfoauthor=basicinfo.author();
basicinfoprice=basicinfo.price();
bookinfo[j][0]=basicinfotitle;
bookinfo[j][1]=basicinfoauthor;
bookinfo[j][2]=basicinfoprice;
}
string yesno;
while(yesno!="q"){
cout<<"Enter q to quit at any time"<<endl;
cout<<"Would you like to display all book info?(yes or no)"<<endl;
cin>>yesno;
if(yesno=="yes"){
for(j=0;j<2;j++){
cout<<bookinfo[j][0];
cout<<bookinfo[j][1];
cout<<bookinfo[j][2];
}
}
cout<<"Which book would you like to edit?" <<endl;
cin>>j;
cout<<"Which part woudl you like to edit?"<<endl;
cin>>k;
cout<<"Make changes: "<<endl;
cin>> basicinfotitle;
basicinfotitle=bookinfo[j][k];
cout<<bookinfo[j][k];
}
//if(
//cin>>bookinfo[j][k];
}