#include <iostream.h>
#include <stdio.h>
#include <conio.h>
void main ()
{int a,b;
printf("\033[31m");
cout<<"a=";cin>>a;
cout<<"b=";cin>>b;
cout<<"Suma este..."<<a+b<<endl;
getch();} // he want to return a color Red but he doesn't work...
I need help...
see u.
ANSi Driver -inC++
Hi, I use windows Xp and I want to use the driver ANsi;In "c:\windows\system32\config.nt" and there , in config.nt I wrote device=c:\windows\system32\ansi.sys . I restart my computer and I try to use Ansi colors; This is the code
You should be using the line #include <iostream> and not #include <iostream.h>
I can't see any other problems; why are you using getch() at the end?
I can't see any other problems; why are you using getch() at the end?
Quote:Original post by programwizard
You should be using the line #include <iostream> and not #include <iostream.h>
I can't see any other problems; why are you using getch() at the end?
And cstdio and cconio.
How does it "not work"?
IIRC, windows NT and later will ONLY use the ANSI driver for 16-bit applications. Just use the win32 SetConsoleTextAttribute fuction if you want color in a 32-bit console app.
DukeAtreides076 this point I i write now ...but i don't know hwo to use ... Sertextatributte
:(( ...if u can help me ...
:(( ...if u can help me ...
Quote:Original post by TheFlea
DukeAtreides076 this point I i write now ...but i don't know hwo to use ... Sertextatributte
:(( ...if u can help me ...
If you want to change color, use SCTA like this:
enum COLOR_ENUM{ BLACK, BLUE, GREEN, AQUA, RED, PURPLE, YELLOW, WHITE, GRAY, LIGHT_BLUE, LIGHT_GREEN, LIGHT_AQUA, LIGHT_RED, LIGHT_PURPLE, LIGHT_YELLOW, BRIGHT_WHITE};...//Before you write text, call SCTA like this:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), LIGHT_GREEN);
This is easier to use if you use a stream manipulator.
P.S.
Don't forget to restore the original text color.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement