Hello,
I am just starting out in learning C and I want to make a simple program that creates a string, from the options a user inputs and then sorts that string into a correct format for display.
I have put a comment at where the program is going wrong, can anyone tell me where I am going wrong?
Also I was wondering, I want to put this into a gui, would I be best coding the gui into it at the same time, or is it just as easy to get it working correctly in command prompt, then
putting the gui in around it?
Code:
if (num == 2) {
strcat(string, define1);
printf(" \n\n a - define2\n b - define3\n c - define4\n d - define5s\n e - define6\n f - define7\n");
b = getchar();
}
if (b == 'a') {
strcat(string, define2);
}
else if (b == 'b') {
strcat(string, define3);
}
else if (b == 'c') {
strcat(string, define4);
}
else if (b == 'd') {
strcat(string, define5);
}
else if (b == 'e') {
strcat(string, define6);
}
else if (b == 'f') {
strcat(string, define7);
}
if (b == 'e' || b == 'f') {
printf(" \n\n a - define12\n b - define13\n c - define14\n d - define15\n");
c = getchar(); // works good up to here, it prints above statement, but then ends rather than asking for the next option.
}
if (c == 'a') {
strcat(string, define12);
}
else if (c == 'b') {
strcat(string, define13);
}
else if (c == 'c') {
strcat(string, define14);
}
else if (c == 'd') {
strcat(string, define15);
}
Thanks