Reputation: 43
I am doing an assignment and I was wondering how we get single quotes around a letter writing to the screen. I would like to write: The lower case equivalent of 'A' is 'a'. not double quotes like " but single '. Please C++ only, no C.
cout << " The lowercase equivalent of " << mychar << " is " << input << endl;
Upvotes: 0
Views: 7041
Reputation: 787
cout << " The lowercase equivalent of \'" << mychar << "\' is \'" << input << "\'" << endl;
Should work. Single quotes need to be escaped by the backslash.
Upvotes: 0
Reputation: 26097
Single quotes should work just fine inside double quotes:
cout << " The lowercase equivalent of '" << mychar << "' is '" << input << "'" << endl;
Upvotes: 3