Array...Question...

This is my code...How to put string in row and column of array that i want. I want that, when a user write a string, that this string stay in array...how to make this?

#include <fstream>
#include <iostream>
#include <string>
#include "biblioteka_vrijeme.cc"
using namespace std;



void predlozak(int i2, int j2, string dan, string predmet){
int i,j;

string X[14][6]= { {"Sati ","Ponedjeljak ","Utorak ", "Srijeda ", "Cetvrtak ", "Petak "},

{"7-8"},
{"8-9"},
{"9-10"},
{"10-11"},
{"11-12"},
{"12-13"},
{"13-14"},
{"14-15"},
{"15-16"},
{"16-17"},
{"17-18"},
{"18-19"},
{"19-20"}};

for(i=0;i<14;i++){
for(j=0;j<6;j++){
cout<<X[i][j]<<" ";
}
cout<<endl<<endl;
}

}

void unos(){
char dalje;
string dan, predmet;
int prvi_sat, drugi_sat;
do{
cout<<"Dan predavanja: ";
cin>>dan;
cout<<"Od: ";
cin>>prvi_sat;
cout<<"Do: ";
cin>>drugi_sat;
cout<<"predmet: ";
cin>>predmet;
if(prvi_sat==7 && drugi_sat==8){
if(dan=="ponedjeljak"){
predlozak(1,1, dan, predmet);
}
}
cout<<"dalje: ";
cin>>dalje;
}while(dalje =='d');
}


int main(){
int odabir;
do{
cout<<"------------------------------------"<<endl;
cout<<" IZRADA RASPOREDA "<<endl;
cout<<"------------------------------------"<<endl;
cout<<"1. Unos novog raspsporeda predavanja"<<endl;
cout<<"2. Odabir postojećih rasporeda"<<endl;
cout<<"4. Brisi"<<endl;
cout<<endl;
cout<<"Vas odabir: ";
cin>>odabir;
switch(odabir){
case 1:
unos();
break;

case 2:
break;
}

}while(odabir!=6);
return 0;
}
Use indexes. For example

X[0][0] = "It is an example";
Topic archived. No new replies allowed.