I've used the following code for getting a string and using its first character to make another string:
char gramG[100],aug[100],start; cout<<"\nEnter the grammar:\n"; cin.getline(gramG,100,'.'); start=gramG[0]; aug[0]=start; aug[1]='\''; aug[2]='-'; aug[3]='>'; aug[4]=start; aug[5]=char(13); cout<<aug; cout<<aug[0]; In the above code when i'm printing 'aug' it prints as ' ¶'->A ' if A is my start symbol. If i am printing only aug[0] then it is printing correctly A. But when i am printing the string as a whole the aug[0] value is printed as some garbage. Please help.
std::stringand itsoperator+=?