You are on page 1of 2

/*dz 1 ya ne znala chto mojno ispolzovat krome char*/

#include <iostream>
using namespace std;

int main() {
int num1;
int num2;
char operation;

cout<<"Enter first number:";


cin>>num1;
cout<<"Enter second number:";
cin>>num2;
cout<<"Enter (+, -, *, /) ";
cin>>operation;

switch(operation) {
case '+':
cout<<"Result:"<<num1 + num2<<endl;
break;
case '-':
cout<< "Result:"<<num1 - num2<<endl;
break;
case '*':
cout<<"Result:"<<num1 * num2<<endl;
break;
case '/':
if (num2 = 0)
cout<<"Result:"<<num1 / num2<<endl;
else
cout<<"Error"<<endl;
break;
}

return 0;
}

/*dz 2*/

#include <iostream>
using namespace std;

int main()
{
int length;
char symb;

cout<<"Enter length: ";


cin>>length;
cout<<"Enter symbol: ";
cin>>symb;

for(int i = 0; i < length; ++i)


{
cout<<symb<<endl;
}
return 0;
}

You might also like