Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<string>
- using namespace std;
- /*Описать тип Complex - с полями вещественного типа re(действительная часть), im
- (мнимая часть) и функцию conjComplex(c), с параметром c типа Complex, которая
- вычисляет комплексно - сопряженное для c комплексное число.Аргумент с является
- входным и выходным параметром.Применить функцию conjComplex для вычисления
- комплексно - сопряженных чисел для пяти заданных комплексных чисел. */
- struct karmasiksayi
- {
- public:
- int reel;
- int sanal;
- void print(karmasiksayi a)
- {
- if (a.sanal > 0)
- cout << a.reel << "-" << +1 * a.sanal << "i" << endl;
- else if (a.sanal < 0)
- cout <<a.reel << "+" << -1 * a.sanal << "i" << endl;
- else
- cout << a.reel << endl;
- }
- };
- int main()
- {
- karmasiksayi s1 , a;
- cout << "reel:";
- cin >> s1.reel;
- cout << "sanal:";
- cin >> s1.sanal;
- a.print(s1);
- }
- /*Даны названия 26 городов и стран, в которых они находятся.Среди них есть города,
- находящиеся в Италии.Напечатать их названия.*/
- /*void siralama(struct al* a);
- struct al
- {
- string country;
- string city;
- };
- int main()
- {
- struct al a[100];
- for (int i = 0; i < 26; i++) {
- cout << "country" << i + 1 << ":";
- cin >> a[i].country;
- cout << "city" << i + 1 << ":";
- cin >> a[i].city;
- }
- siralama(&a[0]);
- return 0;
- }
- void siralama(struct al* a) {
- for (int i = 0; i < 26; i++) {
- if ((*(a + i)).country == "italy") {
- cout << "italy-city:" << (*(a + i)).city << endl;
- }
- }
- }*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement