suparty beauty

suparty beauty

Jumat, 22 April 2011

program membalik angka




Deklarasi:
                Balik,tempat,n: integer
Deklarasi:
          temp = temp * 30 + n % 30;
          if (temp == 0) cout << "0";
          n = n/30;
outputnya: balik angka

#include <cstdlib>
#include <iostream>
using namespace std;
int balik(int n) {
    int temp = 0;
    while (n>0) {
          temp = temp * 30 + n % 30;
          if (temp == 0) cout << "0";
          n = n/30;
    }
    cout << temp;
    return temp;
}
int main(int argc, char *argv[])
{
    int bil;
    cout << "Masukkan bilangan : ";
    cin >> bil;
    cout << "Setelah dibalik : " << balik(bil);
    system("PAUSE");
    return EXIT_SUCCESS;
}




ITERATIVE TO REKURSIVE CONVERSION
    
    Iterative Step:
       for(int i=0;i<7;i++)
       cout<<“mencoba rekursi\n”;
    Rekursive Step:
      void coba(int i)
      {if(i==7)
     {}
     else
     cout<<“mencoba rekursi\n”;coba i+1;
     }
     main()
    {int i=0;
    coba(i);
    }

B.REKURSIVE TO ITERATIVE

   Rekursive Step:
   void coba(int i)
   {if(i==7)
   {}
   else
   cout<<“mencoba rekursi\n”;coba i+1;
   }
   main()
   {
   int i=0;
   coba(i);
   }
   Iterative Step:
   for(int i=0;i<7;i++)
   cout<<“mencoba rekursi\n”;
 


C. ANALISIS

For example, the function is called with value i = 0 so for the first we must check is i = 5 {if(i==5) or not, and if its have a same value its will be out.
  In reality, i is not same with 0 so, please add i with 1. And the condition now become i = 2.
In next line, we show the value of i. Next, called rekursive function with value i = 2.
That steps is repeating until rekursive function calling with value i = 5. 
For now, the if condition is true and that make the function out (return) and continue the command after calling rekursive function with i = 5. Then print out value i.
After print out value i then rekursive function will be out again, and go a head to the command after calling rekursive function where the value before is i = 4. And thats repeating until the value i = 0, thats the first calling rekursive function.

This is the calling rekursif function ilustrated in Indonesia: 
Langkah ke :
 1. i = 4 ; mencoba rekursi
2.i = 6 ; mencoba rekursi
3. i = 5 ; mencoba rekursi
4. i = 4 ; mencoba rekursi
5. i = 3 ; mencoba rekursi
6. i = 2 ; mencoba rekursi
7. i = 1 ; mencoba rekursi
Jika di panggil i=7akan keluar,sebaliknya dengan operasi rekursif ke iteratif.

progra membalik angka




Deklarasi:
                Balik,tempat,n: integer
Deklarasi:
          temp = temp * 30 + n % 30;
          if (temp == 0) cout << "0";
          n = n/30;
outputnya: balik angka

#include <cstdlib>
#include <iostream>
using namespace std;
int balik(int n) {
    int temp = 0;
    while (n>0) {
          temp = temp * 30 + n % 30;
          if (temp == 0) cout << "0";
          n = n/30;
    }
    cout << temp;
    return temp;
}
int main(int argc, char *argv[])
{
    int bil;
    cout << "Masukkan bilangan : ";
    cin >> bil;
    cout << "Setelah dibalik : " << balik(bil);
    system("PAUSE");
    return EXIT_SUCCESS;
}

belajar tentang program



#include <cstdlib>
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char *argv[]){
 ifstream in("data aku party");
 if(!in){
 cout<<"Tidak Dapat membuka data aku party .\n";
 return 1;}
 char item[20];
 float berat, tinggi, lebar;
 in>>item>>berat;
 cout<<item<<""<<berat<<"\n";
 in>>item>>tinggi;
 cout<<item<<""<<tinggi<<"\n";
 in>>item>>lebar;
 cout<<item<<""<<lebar<<"\n";
 in.close();
system("PAUSE");
return EXIT_SUCCESS;
}

Rabu, 20 April 2011

program menghitung baris dan deret

#include <cstdlib>
#include <iostream>

using namespace std;

class hitung
{
     
public:
       int proses();
       void input();

private:
        int n;
        float rumus,jumlah,total;
};

void hitung::input()
{
     cin >> n;
     cout << endl;
}
   
int hitung::proses()
{
    jumlah = 0;
    total = 0;
    rumus = -1;

          for(int j=1; j<=n; j++){
                  rumus = (rumus * (-1));
                  total = rumus / j;
                  jumlah+= total;
                  if(j==1)
                  cout << " ( " << total << " ) ";
                       if( j > 1)
                           cout << " + ( " << total << " ) ";
}

cout << endl << endl << " Jumlah Rekursif = " << jumlah;
cout << endl;

return jumlah;
}

int main(int argc, char *argv[])
{
    cout << " Program Menghitung Jumlah dari Dumus 1-(1/2)+(1/3)-(1/4)+...+(1/n) ";
    cout << endl;
    cout << endl;
    cout << " Masukkan Nilai n : ";
   
    hitung deret;
    deret.input();
    deret.proses();
   
    system("PAUSE");
    return EXIT_SUCCESS;
}
    mari kita saksikannn hasil dari program di atas ...... ... di bawah ini
silahkan ... jika yang mau  ... program ini ... ... silahkan  ya..dan selamat mencobanya  ya..




let us saksikannn res ult of the above program ...... ... below
please ... if that would ... This program ... ... yes please try it .. and yes .. congratulations

waduhhh tennis there is an error .. moment .. before I'm Sorry....

membuat tahapan penyelesaian baris dan deret dalam bahasa inggris

 (1) 3, 7, 11, 15, 19, ...
          (2) 30, 25, 20, 15, 10,.

Note that the difference between ethnic-tribe is always fixed. Such rows are called ranks arithmetic. The difference is called a different tribe or a different course and is denoted by c.
           Rows (l) has a different, b = 4. Front row is called an arithmetic increase because the value of interest-tribe bigger.
           Rows (2) has a different, b = -5. Front row is called arithmetic down because the value of the smaller ethnic-tribe.
A line of U1, U2, U3,.... called an arithmetic sequence if the difference of two successive rate is fixed. Value To determine the rate of the n-th row of arithmetic. consider again the example sequence (l).


 Let U1, U2, U3, .... is the arithmetic sequence is then
U1 = 3 =+ 4 (0)

       U2 = 7 = 3 + 4 = 3 + 4 (1)
       U3 = 11 = 3 + 4 + 4 = 3 + 4 (2)
            ....
       Un = 3 + 4(n-1)

In general, if the rate of the first (U1) = a and the sequence is different tribe from the formula b, Un = 3 + 4 (n - 1) obtained 3 is a and 4 is b. Therefore, the interest to-n can be formulated

        Un = a + b (n-1)

Rows of arithmetic that have a positive difference is called an arithmetic sequence increased, whereas if a negative difference is called an arithmetic sequence down.

         U1, U2, U3, ....... Un-1, Un-called arithmetic progressions, if
         U2 - U1 = U3 - U2 = .... = Un - Un-1 = constant

Un = a + (n-1) b = bn + (ab) Function linear in n




As discussed earlier, the series is a summation of the tribes in a row. If U1, U2, U3, ... arithmetic sequence. U1, U2, U3, ... is the arithmetic series.
To obtain the number n the first tribe of arithmetic series, note the back row of the resulting sequence (l).
       3 +7 + 1l + 15 + 19 + ...
If the number of first rate denoted n dengan.Sn the S from the above series are:

Picture: 58.jpg

Note the first tribe of 5 S obtained. Number 3 in the calculation is derived from the first tribe, while the l9 is the tribe of the 5th. Therefore, the amount of interest is the n-th

Picture: 59.jpg

If the value of Un is unknown, we use the formula Un, arithmetic sequence, ie Un = a + (n-1) b, so the first term is the number n
Picture: 60.jpg

n the number of first term of an arithmetic series which first rate a and b are different
Picture: 61.jpg

To facilitate the calculation of Sn an arithmetic series, note the following. a. If the first tribe known a and b different, use the formula Image: 62.jpg b. If the first known tribe and tribe to-n, use the formula Image: 63.jpg