Friday, October 25, 2019



Hallo kembali lagi di blog ini. Kali ini saya akan membagikan sebuah program yang dibuat dengan pemrograman C++ yang berfungsi untuk menghitung angka berpangkat.
Oh iya. Disini saya menggunakan Dev-C++ untuk ngoding C++. Sobat bisa download Dev-C++ di google.

Langsung saja copy codenya di bawah ini ya sob!


     #include <iostream>

 using namespace std;

 int pngkt (register int M, register int e){
  register int temp;
  temp = 1;
  for ( ; e; e--) {
  temp =  temp * M;
}

return temp;
 }

  int main() {
  int X;
  float A, B;
 
  menu:
  cout<<"masukkan bilangan : ";
  cin>>A;
 
  if (A <= 0) {
  cout<<"Harap masukkan bilangan positif\n";
  goto menu;
  }
 
  cout<<"masukkan pangkat bilangan tersebut : ";
  cin>>B;
 
  X = pngkt(A, B);
  cout<<"Hasil : " <<X<<endl;
 
  return 0;
 
  }

Sekian untuk postingan kali ini, sampai bertemu lagi di postingan selanjutnya...

0 komentar:

Blog Archive

Popular Posts

Powered by Blogger.

Comments

Recent

Bottom Ad [Post Page]

Contact Form

Name

Email *

Message *

Search This Blog

Travel the world

Full width home advertisement

Keep Traveling

Travel everywhere!

Author Description

Hey there, We are Blossom Themes! We are trying to provide you the new way to look and use the blogger templates. Our designers are working hard and pushing the boundaries of possibilities to widen the horizon of the regular templates and provide high quality blogger templates to all hardworking bloggers!

Advertisement

Weekly post

Post Page Advertisement [Top]

Climb the mountains