Answer to Question #21799 in C++ for Sharone

Question #21799
Hello, how are you?

Using a for loop, how can I assign the alphabet to numbers. Ex: A=1, B=2, etc...
1
Expert's answer
2013-01-09T11:11:29-0500

#include <iostream>
#include <conio.h>

using namespace std;

int main()
{
char
alphabet[]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
for(int i=0;i<26;i++){
cout<<(i+1)<<"
"<<alphabet[i]<<"
";
}
getch();
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