|
Axborot texnologiyalari va kommunikatsiyalarni rivojlantirsh vazirligi
|
Sana | 08.02.2024 | Hajmi | 0,55 Mb. | | #153318 |
Bog'liq 1-amaliy ish
O’ZBEKISTON RESPUBLIKASI
AXBOROT TEXNOLOGIYALARI VA KOMMUNIKATSIYALARNI RIVOJLANTIRSH VAZIRLIGI
MUHAMMAD AL-XORAZMIY NOMIDAGI
TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI
Informatika kafedrasi
Dasturlash asoslari fani bo’yicha
1-Amaliy ishi
Mavzu: Simvolli massivlarni va string turidagi o‘zgaruvchilarga doir masalalar
Bajardi: PRG001-2-guruh talabasi
Hazratqulov Sirojiddin
Tekshirdi: Gulyamova Dilfuza
1.misol
#include
#include
int main() {
double f;
std::cout << "F gradusni kiriting: ";
std::cin >> f;
// F gradusni soat, minut va sekundlarga aylantirish
double h = f / 30;
double m = (h - std::floor(h)) * 60;
double s = (m - std::floor(m)) * 60;
std::cout << "Natija: " << static_cast(h) << " soat " << static_cast(m) << " minut " << s << " sekund" << std::endl;
return 0;
}
2-misol
#include
using namespace std;
double calculateP(double x) {
if (x > 0.4) {
return 0.5 * (3 * x * x - 1);
} else {
return 0.5 * (5 * x * x * x - 3 * x);
}
}
int main() {
double x;
cout << "Enter the value of x: ";
cin >> x;
double result = calculateP(x);
cout << "P = " << result << endl;
return 0;
}
3-misol
#include
#include
using namespace std;
double calculateY(double n, double k, double m, double z) {
double x;
if (z > 1) {
x = z;
} else {
x = z * z + 1;
}
return sin(n * x) + cos(k * x) + log(m * x);
}
int main() {
double n, k, m, z;
cout << "Enter the value of n: ";
cin >> n;
cout << "Enter the value of k: ";
cin >> k;
cout << "Enter the value of m: ";
cin >> m;
cout << "Enter the value of z: ";
cin >> z;
double result = calculateY(n, k, m, z);
cout << "y = " << result << endl;
return 0;
}
4-misol
#include
#include
using namespace std;
double calculateY(double a, double b, double z, double x) {
if (x <= 5 * a) {
return 2.5 * b * b + a * x - 4.5 * cos(x * z);
} else if (x > b) {
return pow((a * a - 5.4 * x), 3) + log(x * z);
} else {
return sqrt(6.5 * b * b + (a - x * x * x * z));
}
}
int main() {
double a, b, z, x;
cout << "Enter the value of a: ";
cin >> a;
cout << "Enter the value of b: ";
cin >> b;
cout << "Enter the value of z: ";
cin >> z;
cout << "Enter the value of x: ";
cin >> x;
double result = calculateY(a, b, z, x);
cout << "y = " << result << endl;
return 0;
}
|
| |