Please help

Please help :(
This is what i want...http://www.freeimagehosting.net/8puoq

empty string is what bothering me... How to put string in right pleace...

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



struct tunos{
char naziv_predmeta[20];
int i, j, prvi_sat, drugi_sat, dan;
tunos *sljedeci;
};


void predlozak(tunos *lista, int unesen){
if(lista->sljedeci==NULL) return;
tunos *zadnji;
zadnji = lista->sljedeci;

const int zbroj = strlen(zadnji->naziv_predmeta);
char naziv[20];




// char txt[256] = "He";
//strcat(txt, "y");


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"}};
cout<<"unesen: "<<unesen<<endl;
do{


X[zadnji->i][zadnji->j]=zadnji->naziv_predmeta;

zadnji = zadnji->sljedeci;
}while(zadnji!=NULL);
cout<<"i: "<<zbroj<<endl;

cout<<"------------------------------------------------------"<<endl;
for(int i=0;i<14;i++){
for(int j=0;j<6;j++){
if(i==0)cout<<X[i][j]<<" ";
if(j==0 && i>0) cout<<X[i][j]<<" ";
if(j==1 && i>0){ if(unesen==1)cout<<X[i][j]<<" "; //manji
else{
if(i==2 && zbroj==3) cout<<X[i][j]<<" ";
else cout<<X[i][j]<<" "; }


}

if(i==1 && j==2){
if(unesen==1){cout<<X[i][j]<<" ";
}
else {cout<<X[i][j]<<" ";

}}


}cout<<endl<<endl;
}


}

int unos(tunos *lista, int unesen){

tunos *novi, *zadnji;
zadnji = lista;
while(zadnji->sljedeci)
zadnji = zadnji->sljedeci;
novi = new tunos;
zadnji->sljedeci = novi;
novi->sljedeci = NULL;
char dalje;

cout<<"Redni broj dana u tjednu (1-5): ";
cin>>novi->dan;
cout<<"Od: ";
cin>>novi->prvi_sat;
cout<<"Do: ";
cin>>novi->drugi_sat;
cout<<"Kolegij: ";
cin>>novi->naziv_predmeta;

switch(novi->prvi_sat){
case 7: novi->i=1;
if(novi->dan==1){ novi->j=1; unesen = 1;}
if(novi->dan==2) novi->j=2;
if(novi->dan==3) novi->j=3;
if(novi->dan==4) novi->j=4;
if(novi->dan==5) novi->j=5;
break;
case 8: novi->i=2;
if(novi->dan==1) novi->j=1;
if(novi->dan==2) novi->j=2;
if(novi->dan==3) novi->j=3;
if(novi->dan==4) novi->j=4;
if(novi->dan==5) novi->j=5;
break;
case 9: novi->i=3;
if(novi->dan==1) novi->j=1;
if(novi->dan==2) novi->j=2;
if(novi->dan==3) novi->j=3;
if(novi->dan==4) novi->j=4;
if(novi->dan==5) novi->j=5;
break;
case 10: novi->i=4;
if(novi->dan==1) novi->j=1;
if(novi->dan==2) novi->j=2;
if(novi->dan==3) novi->j=3;
if(novi->dan==4) novi->j=4;
if(novi->dan==5) novi->j=5;
break;
case 11: novi->i=5;
if(novi->dan==1) novi->j=1;
if(novi->dan==2) novi->j=2;
if(novi->dan==3) novi->j=3;
if(novi->dan==4) novi->j=4;
if(novi->dan==5) novi->j=5;
break;
case 12: novi->i=6;
if(novi->dan==1) novi->j=1;
if(novi->dan==2) novi->j=2;
if(novi->dan==3) novi->j=3;
if(novi->dan==4) novi->j=4;
if(novi->dan==5) novi->j=5;
break;
case 13: novi->i=7;
if(novi->dan==1) novi->j=1;
if(novi->dan==2) novi->j=2;
if(novi->dan==3) novi->j=3;
if(novi->dan==4) novi->j=4;
if(novi->dan==5) novi->j=5;
break;
case 14: novi->i=8;
if(novi->dan==1) novi->j=1;
if(novi->dan==2) novi->j=2;
if(novi->dan==3) novi->j=3;
if(novi->dan==4) novi->j=4;
if(novi->dan==5) novi->j=5;
break;
case 15: novi->i=9;
if(novi->dan==1) novi->j=1;
if(novi->dan==2) novi->j=2;
if(novi->dan==3) novi->j=3;
if(novi->dan==4) novi->j=4;
if(novi->dan==5) novi->j=5;
break;
case 16: novi->i=10;
if(novi->dan==1) novi->j=1;
if(novi->dan==2) novi->j=2;
if(novi->dan==3) novi->j=3;
if(novi->dan==4) novi->j=4;
if(novi->dan==5) novi->j=5;
break;
case 17: novi->i=11;
if(novi->dan==1) novi->j=1;
if(novi->dan==2) novi->j=2;
if(novi->dan==3) novi->j=3;
if(novi->dan==4) novi->j=4;
if(novi->dan==5) novi->j=5;
break;
case 18: novi->i=12;
if(novi->dan==1) novi->j=1;
if(novi->dan==2) novi->j=2;
if(novi->dan==3) novi->j=3;
if(novi->dan==4) novi->j=4;
if(novi->dan==5) novi->j=5;
break;
case 19: novi->i=13;
if(novi->dan==1) novi->j=1;
if(novi->dan==2) novi->j=2;
if(novi->dan==3) novi->j=3;
if(novi->dan==4) novi->j=4;
if(novi->dan==5) novi->j=5;
break;
}
int pomocna = unesen;
return pomocna;



}
For placing the strings in place you need to include the <iomanip> library. Then use cout << setw(n) << "text";, where setw(n) means that your string will have reserved a space of length 'n', and "text" is your text.

For further explanations http://www.cplusplus.com/reference/iostream/manipulators/setw/

Best of wishes,
~ Raul ~
Last edited on
Thank you :D
Topic archived. No new replies allowed.