i'm new to programming in c++ and have been confuzzled by this for two days:
the following code was meant to create a new class ("character") and enter into it information entered by the user such as name etc.
the problem is that whenever i enter something (at one of the scanf statements) the thing crashes. i've copied the scanf statements into blank source files and they run as expected so i'm guessing the problem is something to do with the context. but without a lot of experience with c/c++ the solution has eluded me.
i know there is a great drive on this forum to force people to do their own work but i'd just like to point out that a) i'm not doing classes in programming b) i'm doing this for my own enjoyment and to further my own skills. even if you don't tell me the actual answer, some pointers on where i could find it for myself would be hugely appreciated - i don't mind work but i hate wild-goose chases through pages and pages of tutorials looking for details they just haven't given.
thanks for any help, however small.
printf("Please select a race from the list below:\n\n1. Human\n2. Elf\n3. Half-Elf\n4. Half-Orc\n5. Dwarf\n6. Gnome\n7. Halfling\n\nNumber of chosen race: ");
if (r<1) r=1;
if (r>7) r=7;
printf("Enter your name: ");
printf("Your chosen race: ");
printf("\n\nYour name: %s\n\nIs this information correct? y/n: ",n);