Membuat Text Warna C++

 Nah yang membutuhkan trik memberi warna pada saat pembuatan program di C++, nih gue kasih yang unik.
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#define tampil cprintf
#define warna textcolor


char n[50],mt[50];
int m;
float t1,t2,t3,q,ut,ua,a,total=0,rata2;
float f_ip(void);

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
main()
{
warna(10);
tampil("\nMenghitung IPK\n\n");
cout<<endl;
warna(13);
tampil("+================================+");
cout<<endl;
warna(11);
tampil("\nCopyright by");
cout<<endl;
warna(14);
tampil("\nDiedyk");
cout<<endl;
warna(14);
tampil("\nSuntoro");
cout<<endl;
warna(14);
tampil("\nAtmojo");
cout<<endl;
warna(13);
tampil("\n+================================+");
getch();

cout<<"\n\nNama\t\t:";
gets(n);
cout<<"NIM\t\t:";
cin>>m;
cout<<"Mata Kuliah\t:";
cin>>mt;
cout<<"Tugas 1\t\t:";
cin>>t1;
cout<<"Tugas 2\t\t:";
cin>>t2;
total=t1+t2+t3;
rata2=total/3;
cout<<"Tugas 3\t\t:";
cin>>t3;
cout<<"Quiz\t\t:";
cin>>q;
cout<<"UTS\t\t:";
cin>>ut;
cout<<"UAS\t\t:";
cin>>ua;
clrscr();
warna(13);
tampil("\n-----------------------------------------------------------------------\n");
cout<<endl;
a=f_ip();
cout<<"\n\tNama\t\t: "<<n;
cout<<"\n\tNIM\t\t: "<<m;
cout<<"\n\tMata Kuliah\t: " <<mt;
cout<<"\n\tIP\t\t:";
if (a>91) cout << " A";
else if (a>81) cout << " B+";
else if (a>71) cout << " B";
else if (a>61) cout << " C+";
else if (a>51) cout << " C";
else if (a>31) cout << " D";
else cout << " E";

cout<<"\n\tKeterangan\t: "<<n<<" ";
if (a>91) cout <<"(Lulus)";
else if (a>81) cout <<"(Lulus)";
else if (a>71) cout <<"(Lulus)";
else if (a>61) cout <<"(Lulus)";
else if (a>51) cout <<"(Lulus)";
else if (a>31) cout <<"(Lulus)";
else cout <<"(Tidak Lulus)";
cout<<endl;
warna(13);
tampil("\n-----------------------------------------------------------------------\n");
getch();

}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//************************************************
float f_ip()
{
float total=0;
total=total+(rata2*0.2);
total=total+(q*0.2);
total=total+(ut*0.25);
total=total+(ua*0.35);
return total;
}
//************************************************


Edit sendiri sesuai kreasi mu ya. Semoga bermanfaat.

Comments

Popular posts from this blog

Driver Printer Canon PIXMA MP230, MP237 Terbaru Windows (xp, 7, 8, 10)

OSPF (Open Shortest Path First)

Makalah Keamanan Sistem Informasi