Program C + + Calculating Value Rank X Y With X and Y Real Numbers Integer

this is the syntax of the program calculates the rank nilaiX Y With Xand Y Real Numbers Integer:

 

#include <iostream>
#include <string>
using namespace std;
class pangkat{
      friend ostream& operator<<(ostream&, pangkat&);
      friend istream& operator>>(istream&, pangkat&);
      public:
pangkat(){};
             void hasil();
      private:
float x,p;
int y,i;
};
istream& operator>>(istream&in,pangkat&masuk){
cout<<“MasukkanAngka : “;
         in>>masuk.x;
cout<<“\nMasukkanPangkat : “;
         in>>masuk.y;
         return in;
         }
ostream& operator<<(ostream&out,pangkat&keluar){
cout<<keluar.x<<” pangkat “<<keluar.y<<” : “<<keluar.p;
cout<<endl;
         return out;
         }
void pangkat::hasil(){
p=1;
     for(i=1;i<=y;i++){
p=p*x;
cout<<p<<endl;
                       }
cout<<endl;
     }
int main()
{
pangkat y;
cin>>y;
y.hasil();
cout<<y;
system(“pause”);
return 0;
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: