I got a question

This is a discussion on I got a question within the C++ Programming forums, part of the General Programming Boards category; Is there anything that can be done to change C++ text into different colors or fonts and can you change ...

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    14

    Question I got a question

    Is there anything that can be done to change C++ text into different colors or fonts and can you change the backround from black to somthing else? thank you in advanced
    C++ is me favorite!

  2. #2
    Registered User
    Join Date
    Dec 2005
    Location
    Canada
    Posts
    267

  3. #3
    Registered User
    Join Date
    Dec 2005
    Posts
    14
    thank you and I got a problem with this
    Code:
    #include <iostream>
    #include <cmath>
    
    using namespace std;
    
    int main()
    {
        int randmon[1] = 1000;
        int randmon[2] = 2000;
        int randmon[3] = 3000;
        int randmon[4] = 4000;
        
        if (randmon == 1000)
        {
                    cout<<"Hello";
                    cin.get();
                    
       if (randmon == 2000)
       { 
                   cout<<"What?";
                   cin.get();
       if (randmon == 3000)
       {
                   cout<<"Maybe?!";
                   cin.get();
       if (randmon == 4000)
       {
                   cout<<"No or yes which one?";
                   cin.get();
    }
    }
    }
    }
    }
    Im trying to make it read a random number but a get alot of errors. Any suggestions?
    C++ is me favorite!

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  5. #5
    Registered User
    Join Date
    Dec 2005
    Location
    Canada
    Posts
    267
    Code:
    #include <iostream>
    #include <cmath>
    
    using namespace std;
    
    int main()
    {
        int randmon[5] = {0, 1000, 2000, 3000, 4000};
        
        //I don't get what you're trying to do from this point on
        if (randmon == 1000)
        {
                    cout<<"Hello";
                    cin.get();
                    
       if (randmon == 2000)
       { 
                   cout<<"What?";
                   cin.get();
       if (randmon == 3000)
       {
                   cout<<"Maybe?!";
                   cin.get();
       if (randmon == 4000)
       {
                   cout<<"No or yes which one?";
                   cin.get();
    }
    }
    }
    }
    }

  6. #6
    Registered User
    Join Date
    Dec 2005
    Posts
    14
    Thank you and to you above umm I was just playing around
    also thanx dave
    C++ is me favorite!

  7. #7
    Registered User
    Join Date
    Dec 2005
    Location
    Canada
    Posts
    267
    thank you, i still don't know how to compile a code on codeblock though...

  8. #8
    Registered User
    Join Date
    Dec 2005
    Posts
    14
    but now I get an error saying
    ISO C++ forbids comparrision between pointer and integer
    C++ is me favorite!

  9. #9
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,337
    > ISO C++ forbids comparrision between pointer and integer
    Good for you.
    Wanna post some code to go with that?

  10. #10
    Registered User
    Join Date
    Dec 2005
    Posts
    14
    the code is up there
    C++ is me favorite!

  11. #11
    Registered User
    Join Date
    Mar 2005
    Posts
    140
    You are trying to compare randmon (the starting address of an array) to an integer.

    randmon[i] represents an individual element of the array

  12. #12
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    And you're declaring randmon multiple times. And you can't initialize it like that (it's an array).

    Im trying to make it read a random number but a get alot of errors.
    Try rand() and srand() (<cstdio>), and time() (<ctime>).
    Code:
    #include <iostream>
    #include <cstdio>
    #include <ctime>
    
    int main(void) {
        srand(time(0));
        std::cout << "A random number between 0 and 9: " << rand() % 10 << std::endl;
        return 0;
    }
    (Sorry, Prelude.)
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Alice....
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 06-20-2005, 02:51 PM
  2. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  3. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 12:47 AM

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