Rabu, 18 Februari 2015

INPUT DATA NILAI MAHASISWA

#include <iostream>
#include <conio.h>
#include <string>
#include <fstream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

main(int argc, char *argv[])

{
ofstream file_nilai;
int n,m;

cout<<"\tdata mahasiswa\n";
cout<<"------------------------------------\n";

cout<<"masukkan jumlah mahasiswa : ";
cin>>n;
int o[n];
float p[n],q[n],r[n],s[n];
string a[n];
cout<<endl;
m=0;
while (m<n){

cout<<"nama mahasiswa = ";
cin>>a[m];
cout<<"nim mahasiswa = ";
cin>>o[m];
cout<<"nilai harian = ";
cin>>p[m];
cout<<"nilai uts = ";
cin>>q[m];
cout<<"nilai uas = ";
cin>>r[m];
s[m]=(4*p[m]+4*q[m]+4*r[m])/300;
if(s[m]>=2.00)
{
cout<<"\nnilai akhir = "<<s[m];
cout<<"\nlulus";}
else
{
cout<<"\nnilai akhir = "<<s[m];
cout<<"\nbelum lulus";
}

cout<<endl;
cout<<endl;
m++;
}
file_nilai.open("data.txt");
if (file_nilai == NULL)
{
cout<<"File fail to open";
}
else
{for(m=0;m<n;m++){
file_nilai<<"Tampilkan Data hasilnya\n";
file_nilai<<"NAMA\t\tNIM\t\tHARIAN\tUTS\tUAS\tHASIL\n";
file_nilai<<a[m]<<"\t"<<o[m]<<"\t"<<p[m]<<"\t"<<q[m]<<"\t"<<r[m]<<"\t"<<s[m];
file_nilai.close();
}
getch();
}}


hasil>>>

Related Posts:

  • program mencari titik tengah#include <iostream> using namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char *argv[]) {     double a,b,c;  &n… Read More
  • CARA FLASH BB Berhubung lagi ada gadget nganggur, akhirnya iseng-iseng saya Upgrade OS-nya beberapa hari yang lalu. Dan yang jadi sasaran empuk saya kemaren adalah BlackBerry Curve Gemini 8520, Yupz, BlackBerry jadul yang sampe hari ini m… Read More
  • INPUT DATA NILAI MAHASISWA#include <iostream> #include <conio.h> #include <string> #include <fstream> using namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */ ma… Read More
  • MEMASUKKAN DATA NILAI TERTINGGI TERENDAH DAN RATA-RATAusing namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char *argv[]) {    int x[100],n,max,min,i;    double a,b; … Read More
  • program tukar nilai bilangan #include <iostream>using namespace std;/* run this program using the console pauser or add your own getch, system("pause") or input loop */int main(int argc, char *argv[]) {    int a,b,c,d; &nb… Read More

0 komentar:

Posting Komentar