Wednesday, 24 December 2014
DATA NILAI MAHASISWA C++
#include<conio.h>
#include<stdio.h>
#include<iomanip.h>
main ()
{
int i;
char nama[5][20];
float nilai1[5];
float nilai2 [5];
float hasil [5];
for(i=1;i<=2;i++)
{
cout<<"data ke_"<<i<<endl;
cout<<"nama siswa:";gets(nama[i]);
cout<<"nilai mid test:";cin>>nilai1[i];
cout<<"nilai final:";cin>>nilai2 [i];
hasil[i]=(nilai1[i]*0,40)+(nilai2[i]*0,60);cout<<endl;
}
cout<<"===================================";
cout<<"==================================="<<endl;
cout<<"no.nama siswa nilai nilai";
cout<<"hasil"<<endl;
cout<<"mid test final";
cout<<"ujian"<<endl;
cout<<""<<endl;
for(i=1;i<=2;i++)
{
cout<<setiosflags(ios::left)<<setw(4)<<i;
cout<<setiosflags(ios::left)<<setw(20)<<nama[i];
cout<<setprecision(2)<<""<<nilai1[i];
cout<<setprecision(2)<<""<<nilai2[i];
cout<<setprecision(2)<<""<<hasil[i]<<endl;
}
cout<<"=================================" ;
cout<<"=================================="<<endl;
getch();
}
Labels:
pemograman ku
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment