Hello . I need some help . I'm trying to make a program that lets me add a text , then replaces every letter with its specific number alphabetically . Basically :
Example -> 5 28 1 13 16 12 5
This is what i've got so far and it doesn't look too good .
Code:#include <iostream> #include <string> using namespace std; int main() { char s[255]; int i; cin.get (s,255); /// That's how i learned at school you read the text . for(i = 1; i <= 31; i++) { /// 31 Letters are in the alphabet . if (s[0] = 'a') /// I was about to make the same thing with b,c,d,etc. cout << "1"; /// 1 because it's a . } return 0; }




Reply With Quote
