#include <iostream>
#include <string>
int main()
{
// prompts for the name of a pet
std::cout << "name of pet? " ;
std::string name ;
// should be able to take in more than a single word name
// http://www.cplusplus.com/reference/string/string/getline/
std::getline( std::cin, name ) ;
// prompt the user for whether or not it is male or female
// accept a single letter answer (M or F). Save it into a character.
std::cout << "male or female (M/F)? " ;
char m_or_f ; // *** note: char
std::cin >> m_or_f ;
// if we got either an 'M' or an 'F', proceed with the program
if( m_or_f == 'M' || m_or_f == 'F' ) // // *** note: there are quotes around character literals
{
// prompt the user for the animals weight and age.
// Store these in two integers.
// TO Do: rest of program
}
}
Thanks for the help. I think you would benefit if you used "using namespace std;" on top of the code next to #include <string>. Then you wouldn't have to type "std"
Then you don't have to put std:: in front of the commands in the source code you're writing.
But it's best practise to do exactly that :+)
I used to do the "using" thing a long time ago, but that gets tiresome - it's easy to accumulate lots of those when using various STL containers and algorithms.
@StrikingSparrow
First up don't delete your original post. It's not helpful.
Second, pay careful attention to what JLBorges does - he is an expert :+)