Hi, I am new to c++ and I learn with a book. I wrote a code from the book, but compiler said It's not alright. So what's wrong? Thanks for answers :).
#<iostream>
int main()
{
char z = 'a';
do
{
std::cout << z << ' ';
z++;
} while ( z <= 'z' );
}
Last edited on
#<iostream>
should be #include <iostream>
.
Oh my God! Sorry for this stupid question.. Compiler said The error is in: std::cout << z << ' '; so i was confused. Thank you so much :).
Is that snippet typed in pretty much as it's found in the tutorial?
As it stands, it's not really good enough to be tutorial code.
Also, see the following article for how to make your code look pretty, like:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
#include <iostream>
int main()
{
char letter = 'a';
do {
std::cout << letter << ' ';
++letter;
} while ( letter <= 'z' );
return 0;
}
|
How to use tags
http://www.cplusplus.com/articles/z13hAqkS/
Last edited on