#include "stdafx.h"
#include "iostream"
using namespace std;
//alidoran
int main() {
int x, s = 0;
cout << "please input yopr number"<<endl;
cin >> x;
s += (x % 10);
x /= 10;
s += (x % 10);
x /= 10;
s += (x % 10);
x /= 10;
s += (x % 10);
x /= 10;
s += (x % 10);
x /= 10;
s += (x % 10);
x /= 10;
cout << "all number plus is : " << s<<endl;
system("pause");
return 0;
}
#include "stdafx.h"
#include "iostream"
#include "cmath"
using namespace std;
//alidoran
int main() {
int x, a, b, c;
float z1, z2, delta;
cout << "you must enter a,b,c in this method" << endl << "ax^2+bx+c=0"<<endl;
cout << "please input a:";
cin >> a ;
cout << "please input b:";
cin >> b;
cout << "please input c:";
cin >> c;
delta = (b * b ) - (4 * a*c);
if (delta < 0) {
cout << "dont have answer" << endl;
system("pause");
return 0;
}
z1 = ((-b) - sqrt(delta)) / (2 * a);
z2 = ((-b) + sqrt(delta)) / (2 * a);
if (z1==z2) cout << z1;
else cout << z1 << endl << z2 ;
cout << endl;
system("pause");
return 0;
}
#include "stdafx.h"
#include "iostream"
#include "time.h"
using namespace std;
//alidoran
int main()
{
char x, y ,z;
cout << "player 1 input 1=stone or 2=paper or 3=clipper";
cin >> x;
cout << "player 2 input 1=stone or 2=paper or 3=clipper";
cin >> y;
if (x == '1' && y == '1') z = 0;
if (x == '1' && y == '2') z = 1;
if (x == '1' && y == '3') z = 2;
if (x == '2' && y == '2') z = 0;
if (x == '2' && y == '1') z = 1;
if (x == '2' && y == '3') z = 2;
if (x == '3' && y == '3') z = 0;
if (x == '3' && y == '2') z = 1;
if (x == '3' && y == '1') z = 2;
else cout << "your number is not in range" << endl; system("pause"); return 0;
switch (z) {
case 0:cout << "mosavi"; break;
case 1:cout << "player 1 win"; break;
case 2:cout << "player 2 win"; break;
}
cout << endl;
system("pause");
return 0;
}
#include "stdafx.h"
#include "iostream"
#include "time.h"
using namespace std;
//alidoran
int main()
{
char x,y;
cout << "player 1 input 1=stone or 2=paper or 3=clipper";
cin >> x;
cout << "player 2 input 1=stone or 2=paper or 3=clipper";
cin >> y;
if (x == '1' && y == '1') cout << "mosavi";
if (x == '1' && y == '2') cout << "player 1 win";
if (x == '1' && y == '3') cout << "player 2 win";
if (x == '2' && y == '2') cout << "mosavi";
if (x == '2' && y == '1') cout << "player 1 win";
if (x == '2' && y == '3') cout << "player 2 win";
if (x == '3' && y == '3') cout << "mosavi";
if (x == '3' && y == '2') cout << "player 1 win";
if (x == '3' && y == '1') cout << "player 2 win";
system("pause");
return 0;
}
#include "stdafx.h"
#include "iostream"
using namespace std;
//alidoran
int main()
{
int x, y,z;
char op;
cout << "enter you operation (like 1+2)"<<endl;
cin >> x >> op >> y;
if (op == '*') z = 0;
if (op == '+') z = 1;
if (op == '-') z = 2;
if (op == '/') z = 3;
if (op == '%') z = 4;
switch (z)
{
case 0: cout << x*y; break;
case 1:cout << x + y; break;
case 2:cout << x - y; break;
case 3:cout << x / y; break;
case 4:cout << x % y; break;
}
cout << endl;
system("pause");
return 0;
}
#include "iostream"
using namespace std;
//alidoran
int main()
{
int age;
cout << "please inpute your age\t";
cin >> age;
if (age < 18) cout << "you are child"<<endl;
if (age >= 18 && age < 65) cout << "you are adult"<<endl;
if (age >= 65) cout << "you are a cenior citizen"<<endl;
system("pause");
return 0;
}
#include "stdafx.h"
#include "iostream"
using namespace std;
//alidoran
int main()
{
int score;
cout << "Enter your test score: "; cin >> score;
switch (score / 10)
{
case 9: cout << "Your grade is an A." << endl; break;
case 8: cout << "Your grade is a B." << endl; break;
case 7: cout << "Your grade is a C." << endl; break;
case 6: cout << "Your grade is a D." << endl; break;
case 5:
case 4:
case 3:
case 2:
case 1:
case 0: cout << "Your grade is an F." << endl; break;
default: cout << "Error: score is out of range.\n";
}
cout << "Goodbye." << endl;
system("pause");
return 0;
}