Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- #include <windows.h>
- #include <stdlib.h>
- using namespace std;
- void gotoxy(int x, int y)
- {
- COORD coord;
- coord.X = x;
- coord.Y = y;
- SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
- }
- int main()
- {
- struct msh
- {
- char npm[9];
- char nama[25];
- char kelas[30];
- int UTS, UAS, total;
- } pmhs[10];
- int i,n;
- system("cls");
- printf("PROGRAM DATA MAHASISWA \n");
- printf("---------------------- \n\n");
- printf("Masukkan Banyaknya Data : ");
- scanf("%d", &n);
- printf("\n");
- for (i=0; i<n; i++)
- {
- printf("Input Data Mahasiswa Ke-%d\n",i+1);
- printf("Nama Anda : ");
- scanf("%s", &pmhs[i].nama);
- printf("NPM Anda : ");
- scanf("%s", &pmhs[i].npm);
- printf("Kelas Anda : ");
- scanf("%s", &pmhs[i].kelas);
- printf("Nilai UTS : ");
- scanf("%d", &pmhs[i].UTS);
- printf("Nilai UAS : ");
- scanf("%d", &pmhs[i].UAS);
- pmhs[i].total = (pmhs[i].UTS * 0.70) + (pmhs[i].UAS * 0.30) + 1;
- printf("\n\n");
- }
- printf("Tekan Sembarang tombol ... !");
- getch();
- system("cls");
- printf(" \t\t\tOutput Data Mahasiswa \n\n");
- printf("=================================================================\n");
- printf(" No. Nama NPM Kelas UTS UAS TOTAL\n");
- printf("=================================================================\n");
- for (i=0; i<n; i++)
- {
- gotoxy(2, i+6); printf("%d.",i+1);
- gotoxy(7, i+6); printf("%s",pmhs[i].nama);
- gotoxy(22, i+6); printf("%s",pmhs[i].npm);
- gotoxy(35, i+6); printf("%s",pmhs[i].kelas);
- gotoxy(46, i+6); printf("%d",pmhs[i].UTS);
- gotoxy(52, i+6); printf("%d",pmhs[i].UAS);
- gotoxy(60, i+6); printf("%d",pmhs[i].total);
- printf("\n");
- }
- printf("=================================================================\n");
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement