Kamis, 12 Desember 2013

BAHASA C++


NO.1
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <iostream.h>

main()
{
    char kata[300]="Akademik manajemen informatika dan komputer bina sarana informatika";
    cout<<kata<<endl;

    cout<< "Berjumlah=" <<endl <<endl;

   cout<<strlen(kata);
    getch;
}

NO.2
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <iostream.h>

main()
{
    char kata[100]="Akademik Manajemen Informatika dan komputer bina sarana informatika";

    clrscr();

    cout<<kata<<endl;



    cout<<"Hasil Perubahan ="<<strrev(kata);

    getch();
}

NO.3
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <iostream.h>

main()
{
    char kalimat1[30]="manajemen";
    char kalimat2[30]="informatika";
    cout<< kalimat1<<endl;
    cout<< kalimat2<<endl <<endl;

    cout<<strcat(kalimat1, kalimat2);
    getch();
}

NO.4
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <iostream.h>

main()
{
    char kalimat1[10]="35.6";
    char kalimat2[10]="12.5";

    cout<<kalimat1<<endl;
    cout<<kalimat2 <<endl <<endl;

    cout<< "a. perkalian" <<endl;
    cout<<atof(kalimat1)* atof(kalimat2)<<endl <<endl;

    cout<<"b. pembagian"<<endl;
    cout<<atof (kalimat1)/ atof (kalimat2)<<endl <<endl;

    cout<<"c. penambahan"<<endl;
    cout<<atof (kalimat1)+ atof(kalimat2) <<endl <<endl;
    cout<<"d.pengurangan"<<endl;
    cout<<atof (kalimat1)-atof (kalimat2) <<endl <<endl;

    cout<<"e.Sisa hasil bagi "<<endl;

    cout<<atol(kalimat1) % atol (kalimat2);

    getch();
}


0 komentar:

Posting Komentar