Minggu, 15 April 2012

Algorithm& Flowchart Determining Number 100 divisible by 3&5


Algorithm & Flowchart Determining Numbers 100 divisible by 3 & 5
v  Flowchart:
v  Description of:
1.      Advance from the start.
2.      Then we give control of the control input with "i ß  0".
3.      Our input recurrence (Looping).
4.      After that we specify the first conditioning: "i> 100".
5.      After the conditioning of both: "i% 3 = 1 and i% 5 = 1".
6.       but if the conditioning value "no" then the output will be in print as "i" and will be entered in the processing of "i  ß i +15" If the conditioning value "yes" then it will be entered in the processing of "i ß i +15".
7.      The process will continue until the "i> 100" trsbt met.
8.      Completed.

v  Syntax C + +:
# Include <iostream>
# Include <string>

using namespace std;
int main ()
{
   int i;

   i = 0;
   while (! (i> 100))
   {
      if (i% 3 == 1 && i% 5 == 1)
      {
      }
      else
      {
         cout << i << endl;}
      i = i +15;
   }
   system ("PAUSE");
   return 0;
}


v  Syntax C + + with Class structure:
# Include <cstdlib>
# Include <iostream>

using namespace std;

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

      public:
      number () {};

      void process () {
            i = 0;
            while (! (i> 100))
            {If (i% 3 == 1 && i% 5 == 1) {
      }
      else
      {
         cout << i << endl;}
      i = i +15;
      }
             }
            
      private:
              int i;
             
};

istream & operator >> (istream & in, & enter the numbers) {
    cout << "Numbers divisible by 3 & 5 =" << endl;
    in >> masukkan.i;

    return in;
}

ostream & operator << (ostream & out, numbers & output) {
    cout << "Bilangannya is" << keluaran.i << endl;

    return out;
}

int main (int argc, char * argv [])
{
    number bil;
    cin >> bil;
    bil.proses ();
    cout << bil;
    cout << endl;

    system ("PAUSE");
    return 0;
}




Algorithm & Flowchart Determining Build space [square / rectangle]
v  Flowchart:
v   Description of:
1.      Advance from the start.
2.      We have input the length of the first.
3.       After that we have input width.
4.      And we set pengkondisiaannya with input "p = l".
5.      If the conditioning value "yes" then it will go in processing the "PUT" Wake Such is the Square "and in outputkan.
6.      But if the conditioning value "no" then the output will be processed sbgmana "PUT" Wake Such is the Rectangle ".
7.      Completed.

v   Syntax C + +:

# Include <iostream>
# Include <string>

using namespace std;
int main ()
{
   raptor_prompt_variable_zzyz string;
   int p;
   int l;

   raptor_prompt_variable_zzyz = "Enter the length:";
   cout << endl << raptor_prompt_variable_zzyz;
   cin >> p;
   raptor_prompt_variable_zzyz = "Put L:";
   cout << endl << raptor_prompt_variable_zzyz;
   cin >> l;
   if (p == l)
   {
      cout << "Build Such is the square" << endl;}
   else
   {
      cout << "Build Such is the Rectangle" << endl;}

   system ("PAUSE");
   return 0;
}


v   Syntax C + + with Class structure:
# Include <cstdlib>
# Include <iostream>

using namespace std;

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

      public:
      bngn_ruang () {};

      void process () {
           if (p == l)
   {
      result = "Wake Such is the Square";}
   else result = "Wake Such is the Rectangle";
             }
            
      private:
               int p;
               int l;
               char * result;
             
};

istream & operator >> (istream & in, bngn_ruang & insert) {
    cout << "Enter the length:" << endl;
    in >> masukkan.p;
    cout << "Enter the width:" << endl;
    in >> masukkan.l;
    return in;
}

ostream & operator << (ostream & out, bngn_ruang & output) {
    cout << "The output is as follows:" << endl << keluaran.hasil;

    return out;
}

int main (int argc, char * argv [])
{
    bngn_ruang space;
    cin >> space;
    ruang.proses ();
    cout << space;
    cout << endl;

    system ("PAUSE");
    return 0;
}





Tidak ada komentar:

Posting Komentar