atoorpatkan
یک شنبه 15 بهمن 1391, 14:48 عصر
سلام دوستان
من یه ماشین حساب تو c++ به صورت عکس زیر طراحی کردم حالا می خوام بعضی از قسمتهاشو رنگی کنم.مثلا داخل کلیدها یه رنگ بشه یا داخل جعبه محاسبه یه رنگ بشه و .... . چجوری میتونم از رنگهای مختلف تو قسمتهای مختلف استفاده کنم.تو c++ . کدش رو هم میزارم.
99470
اینم کدش :
#include <iostream.h>
#include <conio.h>
#include <windows.h>
void graphic();
void puster();
void mohasebe();
void mamad();
void main()
{
int clear;
do {
graphic();
puster();
mohasebe();
mamad();
}while(getch());
}
void mohasebe()
{
double n1=0.0, n2=0.0;
char ch;
gotoxy(22,5);cin >> n1;
if(n1 > 9999999999999){
n1=0;}
gotoxy(22,5);cin >> ch;
gotoxy(22,5);cout << "\t \t \t \t \t";
gotoxy(22,5);cin >> n2;
if(n2 > 9999999999999) {
gotoxy(22,5);
n2=0;
}
switch ( ch )
{
case '+' :n1 += n2; break;
case '-' :n1 -= n2; break;
case '*' :n1 *= n2; break;
case '/' :if(n2 == 0) cout << " %0 can not answer it ";
else
n1 /= n2; break;
default: cout << "Error";
}
if(n1 > 999999999)
{
gotoxy(22,5); cout << "Error! can not answer it";
}
else
{
gotoxy(22,5); cout<<n1;
}
}
void graphic()
{
gotoxy(19,3); cout <<"?????????????????????????????????????????\n";
gotoxy(19,4); cout <<"³ ³\n";
gotoxy(19,5); cout <<"³ ³\n";
gotoxy(19,6); cout <<"³ ³\n";
gotoxy(19,7); cout <<"????????????????????????????????????????´\n";
gotoxy(19,8); cout <<"³ ³ ³ ³ ³ ³\n";
gotoxy(19,9); cout <<"³ 1 ³ 2 ³ 3 ³ / ³ C ³\n";
gotoxy(19,10); cout <<"³ ³ ³ ³ ³ ³\n";
gotoxy(19,11); cout <<"????????????????????????????????????????´\n";
gotoxy(19,12); cout <<"³ ³ ³ ³ ³ ³\n";
gotoxy(19,13); cout <<"³ 4 ³ 5 ³ 6 ³ * ³ + ³\n";
gotoxy(19,14); cout <<"³ ³ ³ ³ ³ ³\n";
gotoxy(19,15); cout <<"????????????????????????????????????????´\n";
gotoxy(19,16); cout <<"³ ³ ³ ³ ³ ³\n";
gotoxy(19,17); cout <<"³ 7 ³ 8 ³ 9 ³ - ³ = ³\n";
gotoxy(19,18); cout <<"³ ³ ³ ³ ³ ³\n";
gotoxy(19,19); cout <<"????????????????????????????????????????´\n";
gotoxy(19,20); cout <<"³ ³ ³ ³\n";
gotoxy(19,21); cout <<"³ ³ 0 ³ ³\n";
gotoxy(19,22); cout <<"³ ³ ³ ³\n";
gotoxy(19,23); cout <<"?????????????????????????????????????????\n";
}
void puster()
{
gotoxy(39,20);
cout << " calculator by:";
}
void mamad()
{
gotoxy(38,22);
cout << "mohammad anvar hagigi";
}
مرسی از همه
من یه ماشین حساب تو c++ به صورت عکس زیر طراحی کردم حالا می خوام بعضی از قسمتهاشو رنگی کنم.مثلا داخل کلیدها یه رنگ بشه یا داخل جعبه محاسبه یه رنگ بشه و .... . چجوری میتونم از رنگهای مختلف تو قسمتهای مختلف استفاده کنم.تو c++ . کدش رو هم میزارم.
99470
اینم کدش :
#include <iostream.h>
#include <conio.h>
#include <windows.h>
void graphic();
void puster();
void mohasebe();
void mamad();
void main()
{
int clear;
do {
graphic();
puster();
mohasebe();
mamad();
}while(getch());
}
void mohasebe()
{
double n1=0.0, n2=0.0;
char ch;
gotoxy(22,5);cin >> n1;
if(n1 > 9999999999999){
n1=0;}
gotoxy(22,5);cin >> ch;
gotoxy(22,5);cout << "\t \t \t \t \t";
gotoxy(22,5);cin >> n2;
if(n2 > 9999999999999) {
gotoxy(22,5);
n2=0;
}
switch ( ch )
{
case '+' :n1 += n2; break;
case '-' :n1 -= n2; break;
case '*' :n1 *= n2; break;
case '/' :if(n2 == 0) cout << " %0 can not answer it ";
else
n1 /= n2; break;
default: cout << "Error";
}
if(n1 > 999999999)
{
gotoxy(22,5); cout << "Error! can not answer it";
}
else
{
gotoxy(22,5); cout<<n1;
}
}
void graphic()
{
gotoxy(19,3); cout <<"?????????????????????????????????????????\n";
gotoxy(19,4); cout <<"³ ³\n";
gotoxy(19,5); cout <<"³ ³\n";
gotoxy(19,6); cout <<"³ ³\n";
gotoxy(19,7); cout <<"????????????????????????????????????????´\n";
gotoxy(19,8); cout <<"³ ³ ³ ³ ³ ³\n";
gotoxy(19,9); cout <<"³ 1 ³ 2 ³ 3 ³ / ³ C ³\n";
gotoxy(19,10); cout <<"³ ³ ³ ³ ³ ³\n";
gotoxy(19,11); cout <<"????????????????????????????????????????´\n";
gotoxy(19,12); cout <<"³ ³ ³ ³ ³ ³\n";
gotoxy(19,13); cout <<"³ 4 ³ 5 ³ 6 ³ * ³ + ³\n";
gotoxy(19,14); cout <<"³ ³ ³ ³ ³ ³\n";
gotoxy(19,15); cout <<"????????????????????????????????????????´\n";
gotoxy(19,16); cout <<"³ ³ ³ ³ ³ ³\n";
gotoxy(19,17); cout <<"³ 7 ³ 8 ³ 9 ³ - ³ = ³\n";
gotoxy(19,18); cout <<"³ ³ ³ ³ ³ ³\n";
gotoxy(19,19); cout <<"????????????????????????????????????????´\n";
gotoxy(19,20); cout <<"³ ³ ³ ³\n";
gotoxy(19,21); cout <<"³ ³ 0 ³ ³\n";
gotoxy(19,22); cout <<"³ ³ ³ ³\n";
gotoxy(19,23); cout <<"?????????????????????????????????????????\n";
}
void puster()
{
gotoxy(39,20);
cout << " calculator by:";
}
void mamad()
{
gotoxy(38,22);
cout << "mohammad anvar hagigi";
}
مرسی از همه