I think it would be a really good idea to do menu selection via a switch statement or an ifelseifelse chain.
Also the logic will be a lot easier if you convert the input to upper case using the toupper function. That saves for having to test for both lower and upper case input.
Statements like this are error prone, non scalable, and UGLY :+)
I would also not use a do loop, just because this always executes once is not necessarily a reason to use it. All 3 loops can be converted from 1 to another - can you figure out how to use a while loop with a switch inside ? You can make use of a bool quit variable.
Your code would also benefit from having more functions. If you use a switch, each case can call a function. A switch can have a default: case, you can use this to catch bad input.
Hope all goes well, and we look forward to seeing your new code :+)
#include <iostream>
#include <string>
int main()
{
std::string name;
std::string Class;
std::cout << "Please enter your name: ";
std::cin >> name;
std::cout << "What class are you using this program for? ";
std::cin >> Class;
std::cout << name << ", Welcome to you Magic Number program. I hope it helps you with your " << Class << " class.\n";
std::cout << "Please choose an option below:\n";
std::cout << "a: Display an example\n";
std::cout << "b: Try it out yourself!\n";
std::cout << "c: Exit\n";
char choice = '\0';
while (choice != 'C')
{
std::cout << "Enter your choice: ";
std::cin >> choice;
choice = toupper(choice);
switch (choice)
{
case'A':
std::cout << "here is the example:\n";
break;
case'B':
std::cout <<" Try it out yourself\n";
break;
case'C':
std::cout << "Goodbye\n";
break;
default:
std::cout << "Please choose a valid menu choice\n";
}
}
return 0;
}