[share]Membuat Nilai Rata-rata dengan c plus-plus

Discussion in 'Programming' started by avirss, Nov 15, 2016.

  1. avirss

    avirss Member

    Joined:
    May 1, 2014
    Messages:
    222
    Likes Received:
    12
    Trophy Points:
    18
    Saat itu saya mulai suntuk apa yang akan saya lakukan. Iseng iseng buka buku eh nemu soal buat belajar program c plus nemu soal buat rata-rata. Tanpa pikir panjang saya kerjakan soal itu dan akhirnya dapat hasil dengan kode berikut.

    yang belajar c plus2 harap perhatikan ya
    Code:
    #include <iostream.h>
    #include <conio.h>
    #include <stdio.h>
      main()
       {
       clrscr();
       char nama_siswa[30];
       int nilai_1,nilai_2,nilai_3,jumlah;
       float rata_rata;
    cout<<"=================================================\n";
    cout<<"Program menghitung nilai rata rata\n";
             cout<<"=================================================\n\n\n\n";
    cout<<"=================================================\n";
    cout<<"Nama Siswa : ";
    cin.getline(nama_siswa,sizeof(nama_siswa));
    cout<<"=================================================\n";
    cout<<"Nilai Perbandingan  1  : "; scanf("%d",&nilai_1);
    cout<<"Nilai Perbandingan  2  : "; scanf("%d",&nilai_2);
    cout<<"Nilai Perbandingan  3  : "; scanf("%d",&nilai_3);
             cout<<"=================================================\n\n\n";
              jumlah=nilai_1+nilai_2+nilai_3;
            cout<<endl;
    
    cout<<"=================================================\n";
    rata_rata=(nilai_1+nilai_2+nilai_3)/3;
    cout<<"Siswa yang bernama "<<nama_siswa<<endl<<"Memperoleh jumlah nilai "
    <<jumlah<<" dengan rata rata  "<<rata_rata<<endl;
    
    
    cout<<"=================================================";
    getch();
    }
    kira kira begini hasilnya,, maklum saja saya pemula hehehhehe
    [​IMG]


    Sumber: Belajar c plus plus
     
  2. avirss

    avirss Member

    Joined:
    May 1, 2014
    Messages:
    222
    Likes Received:
    12
    Trophy Points:
    18
  3. wrep17

    wrep17 Well-Known Member

    Joined:
    Sep 26, 2015
    Messages:
    1,326
    Likes Received:
    246
    Trophy Points:
    63
    Google+:
    Yang C dong, jangan c++ *berkeringat*
     
  4. avirss

    avirss Member

    Joined:
    May 1, 2014
    Messages:
    222
    Likes Received:
    12
    Trophy Points:
    18
    napa mas gan ada yg kurang ya ma c++
     
  5. wrep17

    wrep17 Well-Known Member

    Joined:
    Sep 26, 2015
    Messages:
    1,326
    Likes Received:
    246
    Trophy Points:
    63
    Google+:
    Materi kuliahnya baru di C biasa, blm di c++ aden hehe *hore*
     
  6. avirss

    avirss Member

    Joined:
    May 1, 2014
    Messages:
    222
    Likes Received:
    12
    Trophy Points:
    18
    bukan belajar c++ dulu ya kalau bahasa c jarang orng belajar kalau gg yang c#
     
  7. wrep17

    wrep17 Well-Known Member

    Joined:
    Sep 26, 2015
    Messages:
    1,326
    Likes Received:
    246
    Trophy Points:
    63
    Google+:
    Kalau disaya C dulu hehe, mungkin ntar C++ bisa belajar snediri dah :D
     
  8. Anderila Farmisara

    Anderila Farmisara Member

    Joined:
    Aug 13, 2015
    Messages:
    223
    Likes Received:
    22
    Trophy Points:
    18
    Google+:
    wah saya gak terlalu paham soal ini ikut belajar aja ya hehe
    kalau bahaya C - - ada gak hehehehehe :D
     
  9. Damar

    Damar Well-Known Member

    Joined:
    Jun 22, 2014
    Messages:
    1,467
    Likes Received:
    212
    Trophy Points:
    63
    Google+:
    ini menggunakan BC5 ya? support OS 64bit tidak? :)
     
  10. themebel

    themebel Member

    Joined:
    Jun 6, 2016
    Messages:
    71
    Likes Received:
    6
    Trophy Points:
    8
    wadaw pusing liatnya gan :D *dingin*
     
Loading...
Similar Threads - [share]Membuat Nilai Rata
  1. giovani
    Replies:
    5
    Views:
    788

Share This Page