-
cout char is a number
Hi all, I'm trying to print off a grid system in c++.
My problem is that whenever i try to add to the ascii number it prints off as a number instead of the letter/symbol
Here is a snippit of my code
Code:
char start = 'a'
if(j>=2){
cout << (char)start+1;
start++;
}
As you can see I'm tried casting, doesn't work.
In addition the start++ doesn't work.
Thank you in advanced.
:)
-
Try (char)(start + 1). Actually, it would be easier to just print start and let the start++ do its work for the next iteration.
Wait, there is no loop. So perhaps you should increment start before printing; I don't know what exactly you want to do.
-
Ah thank you. I figured why start++ wasn't working.
I needed to make start a static char.
Thank you anyway.