Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <cstdlib>
- #include "ctime"
- using namespace std;
- typedef char word;
- typedef char* s_word;
- const word *outword(int in_number, word const *in_Im_ed, word const *in_Rod_ed, word const *in_Rod_mn);
- int main() {
- srand(time(NULL));
- setlocale(0, "");
- double volime_grad = rand() % 90 + 1;
- double abc = 180 - 2 * volime_grad;
- size_t select = rand() % 4;
- word *danoe = new word[3];
- word *seach = new word[3];
- switch (select)
- {
- case 0:
- strcpy(danoe, "BAC");
- break;
- case 1:
- strcpy(danoe, "DAC");
- break;
- case 2:
- strcpy(danoe, "BCA");
- break;
- case 3:
- strcpy(danoe, "ACD");
- break;
- }
- select = rand() % 2;
- switch (select)
- {
- case 0:
- strcpy(seach, "ABC");
- break;
- case 1:
- strcpy(seach, "ADC");
- break;
- }
- cout << "Задание:" << endl;
- cout << "В ромбе ABCD угол " << danoe << " равен " << volime_grad << " " << outword(volime_grad, "градус", "градуса", "градусов") << ". Найдите угол " << seach << "." << endl;
- cout << "Ответ дайте в градусах." << endl;
- cout << "Ответ:" << endl;
- cout << abc << endl;
- return 0;
- }
- const word *outword(int in_number, word const *in_Im_ed, word const *in_Rod_ed, word const *in_Rod_mn)
- {
- int goabs = abs(in_number);
- int if100 = goabs % 100;
- int snumber = goabs % 10;
- switch (snumber)
- {
- case 0:
- return in_Rod_mn;
- case 1:
- {
- if (if100 == 11)
- return in_Rod_mn;
- return in_Im_ed;
- }
- case 2:
- case 3:
- case 4:
- {
- if ((if100 >= 12) && (if100 <= 14))
- return in_Rod_mn;
- return in_Rod_ed;
- }
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- return in_Rod_mn;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement