Friday, 18.09.2020, 20:37
Welcome Guest | RSS
Site menu
Login form
Section categories
Search
Calendar
«  September 2020  »
SuMoTuWeThFrSa
  12345
6789101112
13141516171819
20212223242526
27282930
Entries archive
Our poll
Rate my site
Total of answers: 6
Statistics

Total online: 1
Guests: 1
Users: 0

Main » C++ programs
#include <iostream>
using namespace std;


int mul(int x, int y){

    return (x*y);
}

int main()
{
    int i, j;
    int a[10][10];
    for (i=0;i<10;i++){
    for (j=0;j<10;j++)
    a[i][j]=mul(i,j);
    }

 for (i=0;i<10;i++){
    cout<<endl;
    for (j=0;j<10;j++)
        cout<<i<<" * "<<j<<" = "<<a[i][j]<<endl;
            }
            return 0;
            }

Category: C++ programs | Views: 3604 | Added by: H_Imirzyan | Date: 01.07.2011 | Comments (0)

#include <cstdlib>
#include <iostream>


//Gnome Sort Algorithm


using namespace std;

//gnomeSort Function
void gnomeSort(int elements, int arr[])
{
    int i = 0, temp;

    while( i < elements ){

           if ( i == 0 || arr [i - 1] <= arr[i] )
              i++;

           else{
                temp = arr[i];
                arr[i] = arr[i - 1];
                arr[--i] = temp;
           }//end else

    }//en ... Read more »
Category: C++ programs | Views: 572 | Added by: H_Imirzyan | Date: 01.07.2011 | Comments (0)

#include <iostream>

using namespace std;

int stugum(char c) {

   c&=(1<<5);
   if(c==0)
   return 0;
   else
   return 1;
 }

int main(){
char a;
cin>>a;
cout<<stugum(a);
return 0;

}
Category: C++ programs | Views: 441 | Added by: H_Imirzyan | Date: 21.06.2011 | Comments (0)

#include <iostream>

using namespace std;

int main()
{
   char a;
   cin>>a;
   int b=a&(1<<5);
   if(b==0)
   cout<<"upper case";
   else
   cout<<"lower case";cin.get();
   return 0;
}

Category: C++ programs | Views: 451 | Added by: H_Imirzyan | Date: 21.06.2011 | Comments (0)

#include <iostream>

using namespace std;

class Int{
int i;
public:
Int(int a){i=a;}
friend int operator + (Int&, Int&);
friend int operator * (Int&, Int&);
friend int operator % (Int&, Int&);
};
int operator + (Int& a, Int& b){return a.i*b.i-a.i;};
int operator * (Int& a, Int& b){return a.i-b.i;};
int operator % (Int& a, Int& b){return (100*b.i)/a.i;};

int main()
{
    int x,y;
    cin>>x>>y;
    Int a(x),b(y);
    cout<<endl<<a*b+(a+b)<<endl<<a%b;
    return 0;
}

Category: C++ programs | Views: 427 | Added by: H_Imirzyan | Date: 16.06.2011 | Comments (0)

#include <iostream>

using namespace std;

int main()
{
    int i,j,n;
    cin>>n;
    for(int i=n;i>0;--i)
    {
        for(int j=i;j>0;j--)
        cout<<'*';
        cout<<endl;}

    return 0;
}

Category: C++ programs | Views: 5083 | Added by: H_Imirzyan | Date: 10.06.2011 | Comments (0)

#include <iostream>

using namespace std;

int main()
{
    for(int n=9, i=0; n>0, i<10; n--, i++){
    cout<<n<<", ";
    cout<<i<<", ";
    }
    cout<<"Fire!"<<endl;
    return 0;
}

Category: C++ programs | Views: 445 | Added by: H_Imirzyan | Date: 10.06.2011 | Comments (0)

#include <iostream>
#include <string>
#include <sstream>

using namespace std;

int main()
{
    int value1, value2, m;
    string b="Enter a number: ";
    string a;
cout<<b;
getline(cin,a);
stringstream(a)>>value1;
cout<<b;
getline(cin,a);
stringstream(a)>>value2;
m=value1*value2;
if (m>50)
cout<<"m > 50 and is equal to "<<m;
else if (m<50)
cout<<"m < 50 and is equal to "<<m;
else
cout<<"m = 50";cin.get();
return 0;
}

Category: C++ programs | Views: 419 | Added by: H_Imirzyan | Date: 10.06.2011 | Comments (0)

#include <iostream>

using namespace std;

int main()
{
    long a;
    do{
        cout<<"Enter Number (0 to end): ";
        cin>>a;
        cout<<"You Entered: "<<a<<endl;
        }while(a>0);
        return 0;
    }

Category: C++ programs | Views: 423 | Added by: H_Imirzyan | Date: 10.06.2011 | Comments (0)

#include <iostream >
using std :: cout;
using std :: endl;
void encrypt( char [ ] ); // prototypes of functions used in the code
void decrypt( char * ePtr );
int main( )
{
// create a string to encrypt
char string[ ] = "this is a secret!";
cout << "Original string is: " << string << endl;
encrypt( string );
// call to the function encrypt( )
cout << "Encrypted string is: " << string << endl;
decrypt( string );
// call to the function decrypt( )
cout << "Decrypted string is: " << string << endl;
return 0;
}// main

//encrypt data
void encrypt (char e[] )
{
for( int i=0; e[i] != '\0'; ++i ) ++e[i];
} // encrypt

//decrypt data
void decrypt( char * ePtr ) {
for( ; * ePtr != '\0'; ++ ePtr ) --(* ePtr);
}

Category: C++ programs | Views: 442 | Added by: H_Imirzyan | Date: 10.06.2011 | Comments (0)

1 2 3 »