CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Threaded View

  1. #1
    Join Date
    Apr 2018
    Posts
    1

    I'm a beginner . I kinda need help if one fine gentlemen or lady may help a fella out

    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;
    }
    Last edited by 2kaud; April 12th, 2018 at 11:27 AM. Reason: Added code tags

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured