How to add single quotes or double quotes in a program? (solved) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

How to add single quotes or double quotes in a program? (solved)

Please check out the code below and help me to resolve my required output . Thanks in advance. https://code.sololearn.com/c5M0k5NCc0oO/?ref=app

28th Feb 2021, 10:47 AM
Aysha
Aysha - avatar
4 Answers
+ 4
You need to use an escape sequence to insert single or double quotes into a string, i.e. a '\' followed by the character you want to insert. For example, this is what your showdist() method could look like: void showdist() { cout << feet << "\' - " << inches << '\"'; } Escape Sequences: https://en.cppreference.com/w/cpp/language/escape
28th Feb 2021, 10:53 AM
Shadow
Shadow - avatar
+ 8
Thank you Shadow and Mohammed Qadir khan for solving my doubts. I was really confused how to implement it in the program. Now I understood this very clearly. Thank you so much to both of you.
28th Feb 2021, 11:17 AM
Aysha
Aysha - avatar
28th Feb 2021, 10:54 AM
Mohammed Qadir khan
Mohammed Qadir khan - avatar
+ 1
Aysha [Left] Welcome 👍.
28th Feb 2021, 11:39 AM
Mohammed Qadir khan
Mohammed Qadir khan - avatar