1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
#include<iostream>
using namespace std;
int main(){
//make an array of all the letters in the alphabet.
char letters[26]={'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'};
//loop through the array of letters and get the corresponding number.
for(int i = 0; i<26; i++){
cout << letters[i] << " is equal to " << i + 1 << endl;
}
}
|