CARI Infonet

 Forgot password?
 Register

ADVERTISEMENT

View: 3072|Reply: 4

minta tlong untuk programming....

[Copy link]
Post time 22-12-2010 09:08 PM | Show all posts |Read mode
nie coding yg lum siap....arap2 ade yg sdi tlong la ye....
#include <iostream.h>
main()
{
float*CPA[5],a=0;
flaot PMN[5]={3.15,1.52,3.99,1.99,2.50};
int i,j,k;

for(i=0;i<5;i++)
CPA[i]=&MN[i];

cout<<"\n\nGPMN BAGI 5 ORANG PELAJAR YANG DISIMPAN IALAH :\n"<<endl;
for (j=0;j<5;j++)
{
k=j+1;
cout<<"\tGPMN PELAJAR "<<k<<" : "<<*CPA[j]<<endl;
cout<<"\nSTATUS :";

a=*CPA[j];
if (a > 2.0)
{
cout<<"KEDUDUKAN BAIK\n"<<endl;
}
else
{
cout<<"KEDUDUKAN BERSYARAT\n"<<endl;
}
return 0;
}


cam ne nk tambah coding untuk buat pengiraan purata keseluruhan 5 orang pelajar n then papar status keseluruhannya..... {:1_137:}
Reply

Use magic Report


ADVERTISEMENT


Post time 22-12-2010 11:28 PM | Show all posts
Post Last Edit by otai_g at 22-12-2010 23:30

apo nih aku compile ada 11 error.

float jd float..

pointer tu plk mcm x de kegunaan jerk..

hu hu hu...
Reply

Use magic Report

Post time 22-12-2010 11:44 PM | Show all posts

  1. #include <iostream>
  2. using namespace std;

  3. void main()
  4. {
  5.         float CPA[5], a1;
  6.         float PMN[5]={3.15,1.52,3.99,1.99,2.50};
  7.         float total=0, purata;

  8.         for(int i=0;i<5;i++)
  9.                 CPA[i]=PMN[i];

  10.         cout<<"\n\nGPMN BAGI 5 ORANG PELAJAR YANG DISIMPAN IALAH :\n"<<endl;
  11.         for (int j=0;j<5;j++)
  12.         {
  13.                 cout<<"\tGPMN PELAJAR "<<j+1<<" : "<<CPA[j]<<endl;
  14.                 cout<<"\tSTATUS : ";

  15.                 a1=CPA[j];
  16.                 if (a1 > 2.0)         cout<<"KEDUDUKAN BAIK\n"<<endl;

  17.                 else         cout<<"KEDUDUKAN BERSYARAT\n"<<endl;
  18.         }

  19.         for (int c=0;c<5;c++)
  20.                 total+=PMN[c];

  21.         purata=total/5;

  22.         cout<<"\tPURATA : "<<purata<<endl;       
  23. }
Copy the Code
Reply

Use magic Report

 Author| Post time 23-12-2010 01:39 PM | Show all posts
sory2 otai clap eja...yg poiter 2 xtau la pe kgunaan die bab coding 2 lecturer bg....thank sdi tlong....lau nk tmbh status untuk purata keseluruhan kene uat if else lak ke....
Reply

Use magic Report

Post time 8-1-2011 11:33 PM | Show all posts
aku rs mcm ada kesilapan coding aku kat atas tu.
ni yg betul punya.

  1. #include <iostream>
  2. using namespace std;

  3. void main()
  4. {
  5.         float CPA[5];
  6.         float PMN[5]={3.15,1.52,3.99,1.99,2.50};
  7.         float total=0, purata;

  8.         for(int i=0;i<5;i++)
  9.                 CPA[i]=PMN[i];

  10.         cout<<"GPMN BAGI 5 ORANG PELAJAR YANG DISIMPAN IALAH :"<<endl;
  11.         for (int j=0;j<5;j++)
  12.         {
  13.                 cout<<"\n\tGPMN PELAJAR "<<j+1<<" : "<<CPA[j]<<endl;
  14.             
  15.                 if (CPA[j] > 2.0) cout<<"\tSTATUS : KEDUDUKAN BAIK."<<endl;

  16.                 else cout<<"\tSTATUS : KEDUDUKAN BERSYARAT."<<endl;

  17.         }

  18.         for (int c=0;c<5;c++)
  19.                 total+=CPA[c];

  20.         purata=total/5;

  21.         cout<<"\n\tPURATA : "<<purata<<endl;        
  22. }
Copy the Code
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

 

ADVERTISEMENT



 

ADVERTISEMENT


 


ADVERTISEMENT
Follow Us

ADVERTISEMENT


Mobile|Archiver|Mobile*default|About Us|CARI Infonet

8-5-2024 10:39 PM GMT+8 , Processed in 0.092601 second(s), 31 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

Quick Reply To Top Return to the list