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; }
#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
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 »
//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 »
int modInverse(int a, int n) { int i = n, v = 0, d = 1; while (a>0) { int t = i/a, x = a; a = i % x; i = x; x = d; d = v - t*x; v = x; } v %= n; if (v<0) v = (v+n)%n; return v; }
int main() { cout << modInverse(8,16); return 0; }
int shrjum(int tiv) { int n=1, t = tiv; while ((t/10)!=0) { t/=10; n *=10; } if (tiv>=10) return (n*(tiv%10)) + shrjum(tiv/10); else return (tiv%10); }
int main(){ int x; cin>>x; cout<<shrjum(x); return 0; }