THE PROGRAM PRIMES THE CLASS OVERLOADING


Primes are natural numbers greater than 1, the denominator factor is 1 and the number itself. 2 and 3 is prime. 4 is not prime because 4 can be divided by 2. The first ten prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29. and many also bilngan prime laenya, the following is a sample program to determine whether the input including primes, please note the following program.
# include <iostream>
# include <conio.h>

class prime {
      friend ostream & operator <<(ostream &, & prime);
      friend istream & operator>> (istream &, & prime);

    public:
       prime ();
       aku_prima void () {
        while (a! = 0) {
         counter = 0;
         for (i = 2; i <= a-2; i + +) {
         if (a% i == 0) counter + +;}
         if (counter> 0 | | a <2) {
         court <<endl;
         court <<a <<": not a prime number" <<endl;}
         else {
         court <<endl;
         court <<a <<": prime number" <<endl;}
         cin>> a;
         };}

    private:
        int a, i, counter;
        };

prime:: prime () {
     court <<"\ t \ tSlamet Islan Al Hidayah" <<endl;
     court <<"\ t \ t 10018075" <<endl;
     court <<endl;
     court <<"\ t Program to determine the number Prima" <<endl;
     court <<endl;
     }

istream & operator>> (istream & ins, prime & mlebu) {
     court <<"input number:";
     in>> mlebu.a;
     return in;}

ostream & operator <<(ostream & out, primed & metu) {
     return out;}

main () {
z prime;
cin>> z;
z.aku_prima ();
court <<z;

getch ();
return 0;
}
Output :


Well that's the program that I can make,,,,,!
If there are less jelass know any mistake, do not hesitate to leave a comment ataun advice. So that I can fix it later terimakasihh over his visit,,
Regards super ..
 

0 Response to " THE PROGRAM PRIMES THE CLASS OVERLOADING "