Hello & Welcome to our community. Is this your first visit? Register
Follow us on
Follow us on Facebook Follow us on Twitter Watch us on YouTube


MMOCoin

Likes Likes:  0
Results 1 to 1 of 1
  1. #1
    Beginner
    DeVTeo's Avatar
    Join Date
    Nov 2010
    Location
    Bulgaria
    Posts
    9
    Post Thanks / Like
    Rep Power
    15
    Reputation
    1

    [C++]Calculator + green color


    Register to remove this ad
    The Calculator in C++ is very easy but some peoples don't know How to apply green color in it.
    Code:
    #include <iostream>
    using namespace std;
    int main()
    {
        int a,b;
        char ch;
        cout<<"+ | - | * | / |"<<endl;
        cin>>ch;
        
        if(ch=='+')
        {
                   cout<<"Type a number:  "<<endl;
                   cin>>a;
                   
                   cout<<"Type another number:  "<<endl;
                   cin>>b;
                   cout<<a+b<<endl;
        }
        
        if(ch=='-')
        {
                   cout<<"Type a number:  "<<endl;
                   cin>>a;
                   
                   cout<<"Type another number:  "<<endl;
                   cin>>b;
                   cout<<a-b<<endl;
        }
        
        if(ch=='*')
        {
                   cout<<"Type a number:  "<<endl;
                   cin>>a;
                   
                   cout<<"Type another number:  "<<endl;
                   cin>>b;
                   cout<<a*b<<endl;
        }
        
        if(ch=='/')
        {
                   cout<<"Type a number:  "<<endl;
                   cin>>a;
                   
                   cout<<"Type another number:  "<<endl;
                   cin>>b;
                   cout<<a/b<<endl;
        }
        cin.get();
        system("pause");
        return 0;
    }
    This is code of the calculator.
    Code:
    #include <iostream>
    #include <windows.h>
    
    using namespace std;
    
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE) ;
    int main()
    {
        WORD color = FOREGROUND_GREEN;
        SetConsoleTextAttribute(hout, color) ;
        cout << "This is colored text!" ;
    
        cin.get() ;
        return 0;
    }
    This is code of green color.

    Code:
    #include <iostream>
    #include <windows.h>
    using namespace std;
    HANDLE hout=GetStdHandle(STD_OUTPUT_HANDLE);
    int main()
    {
        WORD color=FOREGROUND_GREEN;
        SetConsoleTextAttribute(hout,color);
        int a,b;
        char ch;
        cout<<"+ | - | * | / |"<<endl;
        cin>>ch;
        
        if(ch=='+')
        {
                   cout<<"Type a number:  "<<endl;
                   cin>>a;
                   
                   cout<<"Type another number:  "<<endl;
                   cin>>b;
                   cout<<a+b<<endl;
        }
        
        if(ch=='-')
        {
                   cout<<"Type a number:  "<<endl;
                   cin>>a;
                   
                   cout<<"Type another number:  "<<endl;
                   cin>>b;
                   cout<<a-b<<endl;
        }
        
        if(ch=='*')
        {
                   cout<<"Type a number:  "<<endl;
                   cin>>a;
                   
                   cout<<"Type another number:  "<<endl;
                   cin>>b;
                   cout<<a*b<<endl;
        }
        
        if(ch=='/')
        {
                   cout<<"Type a number:  "<<endl;
                   cin>>a;
                   
                   cout<<"Type another number:  "<<endl;
                   cin>>b;
                   cout<<a/b<<endl;
        }
        cin.get();
        system("pause");
        return 0;
    }
    This is Calculator + Green Color.



    Text color:
    FOREGROUND_GREEN - green color
    FOREGROUND_BLUE - blue color
    FOREGROUND_INTENSITY - white color


    Background color:

    BACKGROUND_GREEN - green color
    BACKGROUND_BLUE - blue color
    BACKGROUND_INTENSITY - white color



    › See More: [C++]Calculator + green color
    Last edited by DeVTeo; 17-02-11 at 04:53 AM.



  2. Related Threads - Scroll Down after related threads if you are only interested to view replies for above post/thread

 

 

Visitors found this page by searching for:

C green color code

c green color

green color code in c

green color in c

c color green

if statement c calculator

green color c

colour code for green in c c color codeswindow h green colour (c program)textcolor(green) in c color code of green in c c calculator green color green c in c code for greenmaking a colorful calculator in c c green colourcolor codes for green in c calculator in c with colorcolor green in code c WORD color=FOREGROUND_GREEN in c if code is green in c text color green code in c green code c green color code c c colour code for greenc numbercode for greengreen color coding in c c colour code greenwhat is green coloured in c c Color::Grenwhat is the color number for green in vc green colors c color code for green in c number green in c full green color code in vc what are the numbers for the color green in c c color codes 10 is greenc green color textSetConsoleTextAttribute mangosc cout color greengreen color number C code for green in c c calculatortext grenn calculatorcalculator c colour codes c greenc taschenrechner cin.getgreen color codes c how to process code calculator in C
SEO Blog

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -5. The time now is 05:16 PM.
Powered by vBulletin® Copyright ©2000-2024, Jelsoft Enterprises Ltd.
See More links by ForumSetup.net. Feedback Buttons provided by Advanced Post Thanks / Like (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
vBulletin Licensed to: MMOPro.org