Help~!~

This is a discussion on Help~!~ within the C++ Programming forums, part of the General Programming Boards category; thanks for all the help. but lol. now it's more of a trojan/ memory killer Code: #include <iostream> #include <stdlib.h> ...

  1. #16
    Registered User
    Join Date
    Jul 2004
    Posts
    14
    thanks for all the help. but lol. now it's more of a trojan/ memory killer

    Code:
    #include <iostream>
    #include <stdlib.h>
    
    using namespace std;
    
    int main()
    {
          unsigned long newVal;
          int wtd;
          int en;
          int key = rand();
          unsigned long messagete;
          sao:
          cout<<"1- Decode   2- Encode"<<endl;
          cin>>wtd;
          if(wtd == 2) {
          cout<<"What message would you like to encode? Max: 500 letters + spaces!"<<endl;
          cin>>messagete;
          newVal = messagete + key;
          newVal %= 256;
          char convertedChar = newVal - 128;
          cout<<"The encoded message is:  ||| " << messagete << " ||| and the secret number is " << key <<endl;
          } else if(wtd == 1) {
    
          }
          goto sao;
          system("PAUSE");
          return 0;
    }
    I tried to re-set the variables to 0 but then it kept on repeating "1- Decode 2- Encode"

  2. #17
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    sigh. You can't input a string into an unsigned long. Read about strings, for loops, while loops, do while loops. Then read about why goto is bad. And look at your code... it's an infinite loop, since you goto sao; no matter what.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help~~
    By joy in forum C++ Programming
    Replies: 6
    Last Post: 11-24-2001, 06:59 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21