Answer to Question #28640 in C++ for Amanda

Question #28640
How do you write the whole alphabet using a for statement?
How do you write the whole alphabet using a while statement?
How do you write the whole alphabet using a do while statement?
1
Expert's answer
2013-04-18T10:18:43-0400
#include<iostream>
using namespace std;

int main(){

&
cout<<"for loop : \n";
for(int i = 'a';i<'z'+1;i++)
& cout<<(char)i;
&
cout<<"\nwhile loop : \n";
char init = 'a';
while(init < 'z'+1){
& cout<<init++;
}

cout<<"\ndo while loop : \n";
init = 'a';
do{
& cout<<init++;
}
while(init < 'z'); &

return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS