Program Menghitung Rata-Rata Mahasiswa - Perintah GOTO C/C++
Praktikum Perintah GOTO C/C++
Hasil running
#include <iostream> #include <stdio.h> #include <conio.h> using namespace std; main (void) { char nama[80]; char tbh; float tugas, uts, uas, rerata; menu: cout<< "Masukan nama = "; cin >> nama; cout << "Masukan nilai tugas = "; cin >> tugas; cout << "Masukan nilai UTS = "; cin >> uts; cout << "Masukan nilai UAS = "; cin >> uas; rerata = (tugas + uts + uas) / 3; cout << "Rerata = " << rerata; printf ("\nApakah mau menghitung lagi [Y/T]"); tbh = getch(); if (tbh == 'Y' || tbh == 'y') { cout << "\n\n"; goto menu; } if (tbh == 'T' || tbh == 't') { printf ("\nSELESAI"); } }
Hasil running
0 Response to "Program Menghitung Rata-Rata Mahasiswa - Perintah GOTO C/C++"
Post a Comment