Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2022
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. #include <windows.h>
  2. #include <string>
  3. #include <iostream>
  4. #include <iomanip>
  5.  
  6. using namespace std;
  7.  
  8. struct HERNIA
  9. {
  10. string COLOR;
  11. double FREQ;
  12. int NUM;
  13. }spectr[7];
  14.  
  15. void InitRainbow(string *c, int *n, double *f);
  16. void OutStruct();
  17.  
  18. int main(int argc, char **argv)
  19. {
  20. system("chcp 1251 > nul"); // Руссификация сообщений
  21. setlocale(LC_ALL, "Russian");
  22.  
  23. string NAME[7]= {"Каждый","Охотник","Желает","Знать","Где","Сидит","Фазан"};
  24. int Num[7]= {0,10,20,30,40,50,60};
  25. double Freq[7]= {3.3, 4.3, 5.2, 5.4, 5.6, 6.5, 7.4};
  26.  
  27. InitRainbow(NAME, Num, Freq);
  28. OutStruct();
  29.  
  30. system("pause"); // system("pause > nul");
  31. return 0;
  32. }
  33. void InitRainbow(string *c, int *n, double *f)
  34. {
  35. for (int a=0; a<7; a++)
  36. {
  37. spectr[a].COLOR= c[a]; spectr[a].FREQ= f[a]; spectr[a].NUM= n[a];
  38. }
  39. }
  40. void OutStruct()
  41. {
  42. cout << setw(10) << "Цвет" << setw(10) << "Частота" << setw(10) << "Номер" << endl;
  43. for (int a=0; a<7; a++)
  44. {
  45. cout << setw(10) << spectr[a].COLOR << setw(10) << spectr[a].FREQ << setw(10) << spectr[a].NUM << endl;
  46. }
  47. }
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement