Open AleksejMoiseev opened 5 years ago
using namespace std;
struct frac_t { int a; int b;
};
frac_t add(const frac_t& r1, const frac_t& r2) { int c1, c2; c1 = r1.ar2.b + r2.ar1.b; c2 = r1.b*r2.b;
frac_t res = { c1, c2 };
return res;
}
frac_t minus(const frac_t& r1, const frac_t& r2) { int c1, c2; c1 = r1.ar2.b - r2.ar1.b; c2 = r1.b*r2.b;
frac_t res = { c1, c2 };
return res;
} frac_t multi(const frac_t& r1, const frac_t& r2) { int c1, c2; c1 = r1.a r2.a; c2 = r1.br2.b;
frac_t res = { c1, c2 };
return res;
} frac_t del(const frac_t& r1, const frac_t& r2) { int c1, c2, c; c1 = r1.a / r2.a; c2 = r1.b / r2.b;
frac_t res = { c1, c2 };
c1 > c2 ? c = c1 : c = c2;
for (int i = 0; i < c; i++)
return res;
}
int main() { frac_t r1 = { }; frac_t r2 = { }; cout << "vvedite "; cin >> r1.a; cout << "vvedite "; cin >> r1.b; cout << "vvedite "; cin >> r2.a; cout << "vvedite "; cin >> r2.b;
frac_t c = std::move(add(r1, r2));
cout << c.a;
cout << " / ";
cout << c.b;
cout << endl;
//cout << "\n" << r1.a;
//cout << "\n" << r1.b;
//cout << "\n" << r2.a;
//cout << "\n" << r2.b;
/*print_rect(r);
move_rect(r, 1, 2);
print_rect(r);
resize_rect(r, 1, 2);
print_rect(r);*/
return 0;
}
using namespace std;
struct frac_t { int a; int b;
};
frac_t add(const frac_t& r1, const frac_t& r2) { int c1, c2; c1 = r1.ar2.b + r2.ar1.b; c2 = r1.b*r2.b;
frac_t res = { c1, c2 };
return res;
}
frac_t minus(const frac_t& r1, const frac_t& r2) { int c1, c2; c1 = r1.ar2.b - r2.ar1.b; c2 = r1.b*r2.b;
frac_t res = { c1, c2 };
return res;
} frac_t multi(const frac_t& r1, const frac_t& r2) { int c1, c2; c1 = r1.a r2.a; c2 = r1.br2.b;
frac_t res = { c1, c2 };
return res;
} frac_t del(const frac_t& r1, const frac_t& r2) { int c1, c2, c; c1 = r1.a / r2.a; c2 = r1.b / r2.b;
frac_t res = { c1, c2 };
c1 > c2 ? c = c1 : c = c2;
for (int i = 0; i < c; i++)
return res;
}
int main() { frac_t r1 = { }; frac_t r2 = { }; cout << "vvedite "; cin >> r1.a; cout << "vvedite "; cin >> r1.b; cout << "vvedite "; cin >> r2.a; cout << "vvedite "; cin >> r2.b;
frac_t c = std::move(add(r1, r2));
cout << c.a;
cout << " / ";
cout << c.b;
cout << endl;
//cout << "\n" << r1.a;
//cout << "\n" << r1.b;
//cout << "\n" << r2.a;
//cout << "\n" << r2.b;
/*print_rect(r);
move_rect(r, 1, 2);
print_rect(r);
resize_rect(r, 1, 2);
print_rect(r);*/
return 0;
}
include
include
include
include
using namespace std;
struct frac_t { int a; int b;
};
frac_t add(const frac_t& r1, const frac_t& r2) { int c1, c2; c1 = r1.ar2.b + r2.ar1.b; c2 = r1.b*r2.b;
}
frac_t minus(const frac_t& r1, const frac_t& r2) { int c1, c2; c1 = r1.ar2.b - r2.ar1.b; c2 = r1.b*r2.b;
} frac_t multi(const frac_t& r1, const frac_t& r2) { int c1, c2; c1 = r1.a r2.a; c2 = r1.br2.b;
} frac_t del(const frac_t& r1, const frac_t& r2) { int c1, c2,c; c1 = r1.a / r2.a; c2 = r1.b/r2.b;
}
int main() { frac_t r1 = { }; frac_t r2 = { }; cout << "vvedite "; cin >> r1.a; cout << "vvedite "; cin >> r1.b; cout << "vvedite "; cin >> r2.a; cout << "vvedite "; cin >> r2.b;
}