iPurchaseOrder Software

Welcome Guest (Register -  Login)  Active Topics Active Topics Display List of Forum Members Memberlist Search The Forum Search Help Help
 Navigation
 Skin Chooser

Choose Skin:


There are 2 skins total.
The newest skin is Classis Default

 Latest Forum Posts

Strings, Text, and Dates
 C++ GamesStrings, Text, and Dates
Subject Topic: Fun Fun Text Post ReplyPost New Topic
 Fun Fun Text
<< Prev Topic | Next Topic >>
ZenithArc
Posted: 15-September-2006 at 12:08pm | IP Logged Quote ZenithArc

Newbie
Newbie


Group: Newbie
Joined: 14-September-2006
Location: United States
Posts: 10

Anyone know if C++ can, and if so how, to change color of text. Not the    'system("COLOR ##");' command, I mean so I can change single lines, words, or letters.



__________________
"I have defied gods and demons. I am your shield; I am your sword. I know you; your past, your future. This is the way the world ends." - Cortana
 
Online Status: Offline
View ZenithArc's Profile Search for other posts by ZenithArc Back to Top
 
ZenithArc
Posted: 15-November-2006 at 9:47pm | IP Logged Quote ZenithArc

Newbie
Newbie


Group: Newbie
Joined: 14-September-2006
Location: United States
Posts: 10
No one? Well xsa!

__________________
"I have defied gods and demons. I am your shield; I am your sword. I know you; your past, your future. This is the way the world ends." - Cortana
 
Online Status: Offline
View ZenithArc's Profile Search for other posts by ZenithArc Back to Top
 
DutchDude
Posted: 06-June-2007 at 2:45am | IP Logged Quote DutchDude
Avatar
Super Dedicated Groupie
Super Dedicated Groupie


Group: Super Dedicated Groupie
Joined: 02-April-2007
Location: Netherlands
Posts: 71
You mean like in HTML?
Where using: <font color="#FF0000">Makes this text color red</font>

if so, techguys

 
Online Status: Offline
View DutchDude's Profile Search for other posts by DutchDude Visit DutchDude's CppGames Back to Top
 
neWWe}{
Posted: 06-June-2007 at 5:25pm | IP Logged Quote neWWe}{
Avatar
Dedicated Groupie
Dedicated Groupie


Group: Dedicated Groupie
Joined: 07-January-2007
Location: France
Posts: 44
I think this should help ;)

#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <wincon.h>

void gotoxy(int x, int y)
{
     COORD c;
     c.X = x;
     c.Y = y;
     SetConsoleCursorPosition (GetStdHandle(STD_OUTPUT_HANDLE), c);
}

void textattr(int _attr) {
  SetConsoleTextAttribute (GetStdHandle(STD_OUTPUT_HANDLE), _attr);
}

the first functions can set the current cursor position so you can print text anywhere in console and the second sets output attributs (weight, color, ...)
play with this functions to understand how it works
 
Online Status: Offline
View neWWe}{'s Profile Search for other posts by neWWe}{ Back to Top
 
tnutty
Posted: 04-January-2009 at 1:31am | IP Logged Quote tnutty
Avatar
Newbie
Newbie


Group: Newbie
Joined: 04-January-2009
Location: United States
Posts: 1
ZenithArc wrote:

Anyone know if C++ can, and if so how, to change color of text. Not the    'system("COLOR ##");' command, I mean so I can change single lines, words, or letters.



in visual studio :

its ..
#include"windows.h"
using namespace std;
int main()
{
system("color 100")

return 0;
}

this will help you.
 
Online Status: Offline
View tnutty's Profile Search for other posts by tnutty Back to Top
 
aica15
Posted: 07-December-2009 at 7:25pm | IP Logged Quote aica15

Newbie
Newbie


Group: Newbie
Joined: 04-December-2009
Location: Philippines
Posts: 1
need help! why does the space can't be read by cin.getline....
what should i do???????
 
Online Status: Offline
View aica15's Profile Search for other posts by aica15 Back to Top
 
mark707
Posted: 13-January-2010 at 2:11am | IP Logged Quote mark707
Avatar
Newbie
Newbie


Group: Newbie
Joined: 08-January-2010
Location: Austria
Posts: 4
spaces can be read with cin.getline()...
i think u mean why space can't be read with cin>>
 
Online Status: Offline
View mark707's Profile Search for other posts by mark707 Back to Top
 
m4ster_r0shi
Posted: 27-March-2010 at 8:43am | IP Logged Quote m4ster_r0shi

Newbie
Newbie


Group: Newbie
Joined: 26-March-2010
Posts: 4
check this out:

------------------------------------------
------------------------------------------

#include <iostream>
#include <windows.h>
using namespace std;

enum Color {FBLUE=1,FGREEN=2,FRED=4,FDARK=8,
           FCYAN=1|2,FPINK=1|4,FYELLOW,FWHITE=1|2|4,
           BBLUE=16,BGREEN=32,BRED=64,BLIGHT=128,
           BCYAN=16|32,BPINK=16|64,BYELLOW=32|64,BWHITE=16|32|64,
           DEFAULT=1|2|4|8};

class ConsoleGraphicsEngine //LOL, like it's DirectX or something...
{
      HANDLE console;
     
      public:
      ConsoleGraphicsEngine()
      {console=GetStdHandle(STD_OUTPUT_HANDLE);}
           
      void set_color(Color c)
      {
           WORD attribute=c;
           SetConsoleTextAttribute(console,c);
      }
};

ostream & operator<<(ostream & os, Color c)
{
        ConsoleGraphicsEngine cge;
        c=Color(c^FDARK);
        cge.set_color(c);
        return os;
}

Color operator|(Color c1,Color c2)
{
      Color c=Color(int(c1)|int(c2));
      return c;
}

int main()
{
    cout << FGREEN << "hello" << FWHITE << "," << endl;
    cout << (FYELLOW|BBLUE|BLIGHT) << "everyone" << FRED << "!" << endl;
    cout << FWHITE << "I am the mighty " << FBLUE << "dr" <<FYELLOW
         << "4" << FBLUE << "gon" << FWHITE << "_" << FRED << "l" << FYELLOW
         << "0" << FRED << "rd" << endl;
    cout << DEFAULT;

    system("pause");
    return 0;
}
 
Online Status: Offline
View m4ster_r0shi's Profile Search for other posts by m4ster_r0shi Back to Top
 
1 User(s) are browsing this topic, 1 Guest(s) and 0 Member(s)
0 Members:
<< Prev Topic Strings, Text, and Dates Next Topic >>

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.2031 seconds.

[ Users browsing page: none ]



Terms and Conditions | Privacy | Contact Us

Copyright © 2010 Cpp Games. All rights reserved.

This site is best viewed at 1024x768 screen resolution.
Back to Top

Designed by Micronet Technologies