|
![]() |
#1 |
![]()
C++ ta hesap makinesi
#include <iostream.h> #include <stdlib.h> int main() //hesap makinesi { //meric-mericliler int n; long int a,b; cout<<"Bu hesap makinesi dir!! >>>meric_MERICLILER<<<"<<endl; cout<<"Asagidaki islemilerden birini seciniz:"<<endl<<endl; cout<<"Toplama islemi icin=1"<<endl; cout<<"Cikarma islemi icin=2"<<endl; cout<<"Carpma islemi icin=3"<<endl; cout<<"Bolme islemi icin=4"<<endl<<endl; cout<<"Kare koku icin=5"<<endl; cout<<"Kare alma islemi icin=6"<<endl; cin>>n; if(n>=5) { cout<<"Sadece tek sayi giriniz"<<endl; cin>>a; } else { cout<<"Ilk sayi'yi giriniz"<<endl; cin>>a; cout<<"Ikinci sayi'yi giriniz"<<endl; cin>>b; } switch(n){ case 1:{cout<<"Sonuc="<<a+b<<endl;break;} case 2:{cout<<"Sonuc="<<a-b<<endl;break;} case 3:{cout<<"Sonuc="<<a*b<<endl;break;} case 4:{cout<<"Sonuc="<<a/b<<endl;break;} case 5:{cout<<"Sonuc="<<sqrt(a)<<endl;break;} case 6:{cout<<"Sonuc="<<a*a<<endl;break;} defult:cout<<"yanlis tusa bastin heralde[IMG]http://www.************/images/smilies/icon_smile.gif[/IMG]"<<endl;break;} cout<<"bu programi >>>PROGRAMCI MERIC<<< yapmistir..."<<endl<<endl; system("PAUSE"); return 99; } C++ ile yaziyi tersten yazma #include <iostream.h> void request(void); void response(void); void try_again(void); int main() { cout << "Created By MTDesign - [email protected]" << endl << "THE OPPOSITE OF THE WORD" << endl << endl; request(); response(); try_again(); } void request(void) { char text[100]; cout << "------------------------" << endl; cout << "Please Enter a Word : "; cin >> text; } void response(void) { char text[100]; int i; cout << "Opposite : "; for (i=strlen(text); i>=0; i--) { cout << text[i]; } cout << "\n------------------------" << endl; } void try_again(void) { char quest; cout << "\nTry Again ... ? E/H : "; cin >> quest; if (quest=='E' || quest=='e') main(); } C++ ile sayisal loto oyunu ! #include <iostream.h> #include <string.h> #include <stdlib.h> #include <time.h> #define SIZE 6 using namespace std; int kupon[SIZE]; int loto[SIZE]; void kupon_doldur(void); void altili_sonuclari(void); void tutanlar_kontrol(void); int main() { cout << "---- PROGRAMMING Muslum TORUN - [email protected] ----" << endl << endl; srand(time(0)); kupon_doldur(); altili_sonuclari(); tutanlar_kontrol(); string bck=""; cout << "\n-------------------------------------------------" << endl << " Tekrar oynamak ister misiniz ? E/H : "; cin >> bck; if ( (bck == "E") || (bck == "e") ) main(); } void kupon_doldur(void) { int i, j, k, at, flag; cout << " Lutfen 6 adet farkli sayi-rakam girin !! " << endl; for (i=0; i<SIZE; i++) { at = i+1; cout << " " << at << ". Rakam= "; cin >> j; kupon[i] = j; flag=0; if ( (j>=1) && (j<=49) ) { for (k=0; k<i; k++) { if (j == kupon[k]) { cout << " ** Lutfen farkli bir rakam girin !" << endl; i--; flag=1; break; } } } else { cout << " ** 1 - 49 Arasinda bir sayi-rakam girmelisiniz !\n"; i--; } } return ; } void altili_sonuclari(void) { int i, sayi, j, k, flag; cout << "--------------------------------------------------" << endl << " # CEKiLiS SONUCLARI # " << endl; for (i=0; i<SIZE; i++) { j = i+1; sayi = rand()%49+1; flag=0; for (k=0; k<i; k++) { if (sayi == loto[k]) { sayi++; break; } } loto[i] = sayi; cout << " " << j << ". Numara : " << loto[i] << endl; } return ; } void tutanlar_kontrol(void) { int tutturdugunuz[SIZE]; int i,tutturulan,k; tutturulan=0; for(i=0;i<SIZE;i++) for(k=0;k<SIZE;k++){ if(kupon[i]==loto[k]){ tutturdugunuz[tutturulan]=kupon[i]; tutturulan++; break; } } cout << "-------------------------------------------------" << endl; cout << " " << tutturulan << " Adet tutturdunuz !" << endl << "-------------------------------------------------" << endl; if(tutturulan!=0)cout << " TUTAN RAKAM-RAKAMLAR\n"; for(i=0;i<tutturulan;i++) cout << " " << tutturdugunuz[i] << " , "; return ; } Yillik gelir tablosu #include<iostream.h> main() { unsigned long int ocak,subat,mart,nisan,mayis,haziran,temmuz,agustos ,eylul,ekim,kasim,aralik; unsigned long int ock,sbt,mrt,nsn,mys,hzrn,tmmz,gsts,yll,km,ksm,rlk; float ciro,komisyon=0; cout<<" OXYGEN SOFTWARE"<<endl; cout<<"HER AYIN CIROSUNU AYRI AYRI GIRINIZ: "<<endl; cout<<"NISAN: "; cin>>nisan; cout<<"MAYIS: "; cin>>mayis; cout<<"HAZIRAN: "; cin>>haziran; cout<<"TEMMUZ: "; cin>>temmuz; cout<<"AGUSTOS: "; cin>>agustos; cout<<"EYLUL: "; cin>>eylul; cout<<"EKIM: "; cin>>ekim; cout<<"KASIM: "; cin>>kasim; cout<<"ARALIK: "; cin>>aralik; cout<<"OCAK: "; cin>>ocak; cout<<"SUBAT: "; cin>>subat; cout<<"MART: "; cin>>mart; ciro = nisan + mayis + haziran; if ( haziran == 0 || haziran != 0 ) if ( temmuz == 0 || temmuz != 0 ) if ( agustos == 0 || agustos != 0 ) if ( eylul == 0 || eylul != 0 ) if ( ekim == 0 || ekim != 0 ) if ( kasim == 0 || kasim != 0 ) if ( aralik == 0 || aralik != 0 ) if ( ocak == 0 || ocak != 0 ) if ( subat == 0 || subat != 0 ) if ( mart == 0 || mart != 0 ) { ciro = nisan + mayis + haziran; komisyon = komisyon + ( ciro / 1000000 ) * 15 / 100; nsn = ( nisan / 1000000 ) * 15 / 100; mys = ( mayis / 1000000) * 15 / 100 + nsn; hzrn = ( haziran / 1000000 )* 15 / 100 + mys; tmmz = ( temmuz / 1000000 ) * 15 / 100 + hzrn; gsts = ( agustos / 1000000 ) * 15 /100 + tmmz; yll = ( eylul / 1000000 ) * 15 / 100 + gsts; km = ( ekim / 1000000 ) * 15 / 100 + yll; ksm = ( kasim / 1000000 ) * 15 / 100 + km; rlk = ( aralik / 1000000 ) * 15 / 100 + ksm; ock = ( ocak / 1000000 ) * 15 / 100 + rlk; sbt = ( subat / 1000000 ) * 15 / 100 + ock; mrt = ( mart / 1000000 ) * 15 / 100 + sbt; cout<<"NISANDA ELINEZE GECEN PARA: "<<nsn<<" MILYON TL"<<endl; cout<<"MAYISTA ELINIZE GECEN PARA: "<<mys<<" MILYON TL"<<endl; cout<<"HAZIRANDA ELINIZE GECEN PARA: "<<hzrn<<" MILYON TL"<<endl; cout<<"TEMMUZDA ELINIZE GECEN PARA: "<<tmmz<<" MILYON TL"<<endl; cout<<"AGUSTOSTA ELINIZE GECEN PARA: "<<gsts<<" MILYON TL"<<endl; cout<<"EYLULDE ELINIZE GECEN PARA: "<<yll<<" MILYON TL"<<endl; cout<<"EKIMDE ELINIZE GECEN PARA: "<<km<<" MILYON TL"<<endl; cout<<"KASIMDA ELINIZE GECEN PARA: "<<ksm<<" MILYON TL"<<endl; cout<<"ARALIKTA ELINIZE GECEN PARA: "<<rlk<<" MILYON TL"<<endl; cout<<"OCAKTA ELINIZE GECEN PARA: "<<ock<<" MILYON TL"<<endl; cout<<"SUBATTA ELINIZE GECEN PARA: "<<sbt<<" MILYON TL"<<endl; cout<<"MARTTA ELINIZE GECEN PARA: "<<mrt<<" MILYON TL"<<endl; cout<<"YILLIK TOPLAM GELIRINIZ: "<<nsn + mys + hzrn + tmmz + gsts + yll + km + ksm + rlk + ock + sbt + mrt<<" MILYON TL"<<endl; } return 0; } Telefon defteri #include<stdio.h> FILE *fp; char ad[15],sy[20],adr[50],tel[15],ceptel[20]; char sec; main() { fp=fopen("BILGILER/TELEFON REHBERI.txt","a"); do { printf("\t\t\tBILGILERI DIKKATLI GIRINIZ\n\n"); printf("\t\tADI :"); scanf("%s",&ad); printf("\t\tSOYADI :"); scanf("%s",&sy); printf("\t\tADRESI :"); scanf("%s",&adr); printf("\t\tTELEFONU :"); scanf("%s",&tel); printf("\t\tCEP TELEFONU :"); scanf("%s",&ceptel); fprintf(fp,"AD:%s %s\n",ad,sy); fprintf(fp,"ADRES:%s\nTEL:%s\nCEP TEL:%s\n",adr,tel,ceptel); printf("\n\n"); printf("\t\tDEVAM ETMEK ISTIYORMUSUNUZ?(E/H)"); fflush(stdin); sec=getchar(); } while(sec!='h' && sec!='H'); fclose(fp); getchar(); } DEVAMI GELECEK... |
|
![]() |
![]() |
![]() |
Etiketler |
eminim, ile, ilgili, programlarisinize, yarayacak |
|
|