Thread: noob with a progblem in program

  1. #1
    Sir Mister Insane Sako Klinerr1's Avatar
    Join Date
    May 2002
    Posts
    608

    noob with a progblem in program

    i am writing a program, te part i ahve fnished it below

    // Hex Code Finder
    // Created by Daniel Strong
    // Feel free to edit this and redistribute this. but you Must leave the above lines there! exactly how they are!
    #include <iostream>
    #include <string>
    #include <stdlib.h>
    #include <windows.h>
    using namespace std;

    int main()
    {
    string input;
    bool black = "OOOOOO"
    bool white = "FFFFFF"
    cout << "Type in a Color to reveal its hexcode. Type All to view all colors indexed." << endl ;
    cin >> input;

    if(bool input = black)
    {
    cout << "The Hex Code for black is... #000000" << input << endl ;
    Sleep(5000);
    }
    else if(bool input = white)
    {
    cout << "The Hex Code for white is... #FFFFFF" << input << endl ;
    Sleep(5000);
    }

    cin.get();
    return 0;
    }
    Problem #1. there is any error, i fixed it once, but i must of did osmething and it returned

    Problem #2. isntead of dipsplaying the varibale it displays 1

    guys please no one steal my idea of my program. This is my firts program and I dont want it to be stupid and useless because somoen else made it.
    Email: [email protected] || AIM: MisterSako || MSN: [email protected]

    -the shroom has spoken

  2. #2
    Sir Mister Insane Sako Klinerr1's Avatar
    Join Date
    May 2002
    Posts
    608
    there seems to be a lot of experianced people around here, there has been 7 veiws and not one of them can help. the stuff im using is only chapter 1 of my c++ book expceft for the if commands
    Email: [email protected] || AIM: MisterSako || MSN: [email protected]

    -the shroom has spoken

  3. #3
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    Code:
    int main()
    {
    string input;
    /*bool black = "OOOOOO";
    bool white = "FFFFFF";
    */
    string black = "000000";
    string white = "FFFFFF";
    cout << "Type in a Color to reveal its hexcode. Type All to view all colors indexed." << endl ;
    cin >> input;
    
    if(input == "black") // changed
    {
    cout << "The Hex Code for black is... #000000" << black << endl ;
    Sleep(5000);
    }
    else if(input == "white") // changed
    {
    cout << "The Hex Code for white is... #FFFFFF" << white << endl ;
    Sleep(5000);
    } else {
       cout << input << " ... I don't know that color" << endl;
    }
    
    cin.get();
    return 0;
    }
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

  4. #4
    Sir Mister Insane Sako Klinerr1's Avatar
    Join Date
    May 2002
    Posts
    608
    you posted that code kinda late, i stayed up 3 extar hours to debug it. it is wrong anyways. you all can see the code once the program is released (i release the source w/ the program)
    Email: [email protected] || AIM: MisterSako || MSN: [email protected]

    -the shroom has spoken

  5. #5
    Registered User
    Join Date
    Aug 2001
    Posts
    244
    Originally posted by Klinerr1
    you posted that code kinda late, i stayed up 3 extar hours to debug it. it is wrong anyways. you all can see the code once the program is released (i release the source w/ the program)
    You, sir, are a muppet.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  2. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  3. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  4. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM