Using Namespace Int Int Int For Int For If If Else: #Include
Using Namespace Int Int Int For Int For If If Else: #Include
Using Namespace Int Int Int For Int For If If Else: #Include
#include <iostream>
using namespace std;
int main()
{
int a=9, b = 9;
int center = b / 2;
for (int i = 0; i < b; i++)
{
for (a = 0; a < b; a++)
{
if (i <= center)
{
if (a > center - i && a < center + i)
cout << "*";
else
cout << " ";
}
else
{
if (a > center + i - b + 1 && a < center - i + b - 1)
cout << "*";
else
cout << " ";
}
}
cout << endl;
}
1.Діапазон и число
#include <iostream>
using namespace std;
int main()
{
int a, b, number = 0;
cout << "Range ->";
cin >> a >> b;
cout << "Number ->";
cin >> number;
if (number <= b and number >= a) {
cout << "4islo naleshit diapazony" << endl;
}
while (number <a || number >b)
{
cout << "4islo ne naleshit diapazony; " << "Number ->";
cin >> number;
if (number <= b and number >= a) {
cout << "4islo naleshit diapazony" << endl;
}
}
}
2.Таблиця умножения
#include <iostream>
#include <time.h>
using namespace std;
int main()
{
srand(time(0));
while (true)
{
int level = 0;
cout << "Select the difficulty level:" << endl;
cout << "1.Easy \n2.Nornal \n3.Hard" << endl;
cin >> level;
switch (level)
{
case 1:
{
int count = 0;
while (count <= 5)
{
int a = rand() % 10 + 1;
int b = rand() % 10 + 1;
cout << a << " * " << b << " = " << endl;
int result = a * b;
int c = 0;
cin >> c;
if (result == c)
{
cout << "True" << endl;
}
else
{
cout << "NO! Result is: " << result << endl;
}
count++;
}
}
case 2:
{
int count = 0;
while (count <= 8)
{
int a = rand() % 10 + 1;
int b = rand() % 10 + 1;
int d = rand() % 10 + 1;
cout << a << " * " << b << " * " << d << " = " << endl;
int result = a * b * d;
int c = 0;
cin >> c;
if (result == c)
{
cout << "True!" << endl;
}
else
{
cout << "Error. Result is: " << result << endl;
}
count++;
}
}
case 3:
{
int count = 0;
while (count <= 11)
{
int a = rand() % 10 + 1;
int b = rand() % 10 + 1;
int d = rand() % 10 + 1;
int e = rand() % 10 + 1;
cout << a << " * " << b << " * " << d << " * " << e << " = "
<< endl;
int result = a * b * d * e;
int c = 0;
cin >> c;
if (result == c)
{
cout << "True!" << endl;
}
else
{
cout << "Error. Result is: " << result << endl;
}
count++;
}
}
}
}
int main()
{
float PayDesk = 0.0;
float CheckAmound = 0.0;
int SoftToyCount = 100, ChristmasToyCount = 100, ChristmasGarlendCount = 100,
ChristmasHatCount = 100, ChristmasOutfitCount = 100;
float const SoftToy = 13.5;
float const ChristmasToy = 10.1;
float const ChristmasGarlend = 15.6;
float const ChristmasHat = 8.4;
float const ChristmasOutfit = 26.8;
while (true)
{
cout << "Soft Toy -- Product code -- 1 -- " << SoftToy << "$" << endl;
cout << "Christmas Toy -- Product code -- 2 -- " << ChristmasToy << "$" <<
endl;
cout << "Christmas Garlend -- Product code -- 3 -- " << ChristmasGarlend <<
"$" << endl;
cout << "Christmas Hat -- Product code -- 4 -- " << ChristmasHat << "$" <<
endl;
cout << "Christmas Ofit -- Product code -- 5 -- " << ChristmasOutfit << "$"
<< endl;