assign values to charechter variables
Hello, I dont know if you give help with this type of question or not but i thought it would be worth a shot. The program I am creating has functions and stuff. I know how to do all of that. My problem occurs when it comes to calling up the functions. The progrtam has 2 different types of functions to call up or the third option is to quit. I have the functions created and I am just trying to write a fake program that will call up the functions. Instead of calling up the functions right now i am just trying to get the program to output 3 different lines depending on the user input. I give the user the choices of entering the letter 's', 'r', or 'q' as their choice. I have it declared as char choice; When I try to compile the program it says: 's' undeclared (first use this function). It also says the same for q and r. someone told me that I have to assign values to charechter variables and I dont know if that is correct and if so how do i do that? I appreciate any help or response
here is what i have for the code
This is what I have in the body of the code. When i try to compile it i get a message that says: 's' undeclared and I also get that same statement for r and q. any help is greatly appreciated.
char choice;
std::cout <<"Enter in the letter s to find out if a specific year is a leap year,";
std::cout<<"Enter in the letter r to find the number of days in a range of years,";
std::cout<<"Enter in the letter q to quit the program: ";
std::cin >>choice;
if (choice == s)
std::cout<<"You chose to find out if a year is a leap year."<<endl;
else if (choice == q)
std::cout<<"You have chose to quit the program."<<endl;
else if (choice == r)
std::cout<<"You have chose to find the number of days in a range of years."<<endl;
return 0;