Wednesday, 24.04.2024, 01:30
Welcome Guest | RSS
Site menu
Login form
Section categories
Search
Calendar
«  April 2024  »
SuMoTuWeThFrSa
 123456
78910111213
14151617181920
21222324252627
282930
Entries archive
Our poll
Rate my site
Total of answers: 6
Statistics

Total online: 1
Guests: 1
Users: 0

Main » Entries archive
#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: 529 | 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: 521 | 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: 551 | Added by: H_Imirzyan | Date: 10.06.2011 | Comments (0)

#include <iostream>
#include <cstdlib>
using namespace std;

long long Exp(long long base, long long exp)
{
long long r=base;
for(int i=1;i<exp;i++)
r*=base;
return r;
}

int main()
{
long long A,B;
long long base,mod;
for(;;)
{
cout << "Base: " << endl;
cin >>base;
cout << "Modulus: " << endl;
cin >>mod;
cout << "Alice, choose your secret number: " << endl;
cin >>A;
cout << "Bob, choose your secret number: " << endl;
cin >>B;
long long a=Exp(base,A)%mod;
long long b=Exp(base,B)%mod;
cout << "Alice's value: " << a << endl;
cout << "Bob's value: " << b << endl;
long long akey=Exp(b,A)%mod;
long long bkey=Exp(a,B)%mod;
cout << "Alice's key: " << akey << endl;
cout << "Bob's key: " << bkey << endl;
}
system("PAUSE");
return EX ... Read more »
Category: C++ programs | Views: 533 | Added by: H_Imirzyan | Date: 10.06.2011 | Comments (0)

#include <iostream>

using namespace std;

#define arg dbl a,dbl b,dbl c
#define dbl double

dbl max1(arg){
    a=(a>b ? (a>c ? a:c) : (b>c ? b : c));
    return a;
}

dbl min1(arg){
    a=(a<b ? (a<c ? a : c) :(b<c ? b : c));
    return a;
}

dbl sum1(arg){
    return a+b+c;
}

dbl average1(arg){
    return (a+b+c)/3;
}

int main(){
    dbl x,y,z,m,s,d,e;
    cout<<"please enter the first value"<<endl;
    cin>>x;
    cout<<"please enter the second value"<<endl;
    cin>>y;
    cout<<"please enter the third value"<<endl;
    cin>>z;
    s=sum1(x,y,z);
    m=average1(x,y,z);
 &nbs ... Read more »
Category: C++ programs | Views: 520 | Added by: H_Imirzyan | Date: 10.06.2011 | Comments (0)

//Note, this works only by GCC compiler
#include <iostream>
#include <fstream>
using namespace std;

#define r m

int bazm(int x,int y){

    return (x*y);
}

int main()
{
    cout<<"Enter the quantity of numbers"<<endl;
    int m;
    cin>>m;
    ofstream out("out.txt");
    int i, j;
    int a[r][r];
    for (i=0;i<r;i++){
    for (j=0;j<r;j++)
    a[i][j]=bazm(i,j);
    }

 for (i=0;i<r;i++){
    out<<endl;
    for (j=0;j<r;j++)
        out<<i<<" * "<<j<<" = "<<a[i][j]<<endl;
            }
      &n ... Read more »
Category: C++ programs | Views: 538 | Added by: H_Imirzyan | Date: 10.06.2011 | Comments (0)

#include <iostream>

using namespace std;

int main()
{
    int n, tiv;
    cin>>n;
    if(n>=1){
        if(n<=9){
    for(tiv=1;tiv<=n;tiv++){
    cout<<n;
    }}}
    return 0;
}

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

#include <iostream>

using namespace std;

int main()
{
   char a;
   cin>>a;
   a|=(1<<5);
   cout<<a<<endl;
   cin.get();
   return 0;
}

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

#include <iostream>

using namespace std;

int main()
{
   char a;
   cin>>a;
   a^=(1<<5);
   cout<<a;
   cin.get();
   return 0;
}

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

#include <iostream>
using namespace std;
int main()
{
    int num;
    for(;;){
    cin>>num;
        do
        {
            cout<<num%10;
            num/=10;
        }
        while(num>0);
        cout<<endl<<"\n";
    }
    return 0;
}

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

« 1 2 3 »