+ 3

how to use char as variable and print name instead of numbers ?

like in basic variable program we declare a = 10 and 10 is printed, so how can I replace integer with char like a = hi and hi gets printed

17th Jan 2018, 2:56 AM
Rushikesh
Rushikesh - avatar
3 Answers
+ 8
@Rushikesh, You can use string in place of int for such cases, for example: string a = "Hi"; cout << a; Is that what you meant? sorry if I misunderstood your question, tell a little more about it if I was wrong : )
17th Jan 2018, 4:42 AM
Ipang
+ 5
like in basic variable program we declare a = 10 and 10 is printed, so how can I replace integer with char like a = hi and hi gets printed
17th Jan 2018, 4:05 AM
Rushikesh
Rushikesh - avatar