Advertisement
Guest User

Untitled

a guest
May 4th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <iostream>
  3. #include <graphics.h>
  4. #include <winbgim.h>
  5. #include <stdlib.h>
  6. #include <stdio.h>
  7. #include <cstdio>
  8.  
  9. using namespace std;
  10.  
  11. int main(int argc, char *argv[])
  12. {
  13. /* initialize graphics window at 300 x 300 */
  14.  
  15. initwindow(400, 700,"Student Level", 500,200);
  16. HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
  17. setcolor(15);
  18. outtextxy(5, 5, "Graphic by BGIM for Windows");
  19.  
  20. int midx, midy;
  21.  
  22. midx = getmaxx() / 2;
  23. midy = getmaxy() / 2;
  24.  
  25. // Points of the student
  26.  
  27. char GroupStud[11];
  28.  
  29. // Variable for read file and any work
  30.  
  31. int i=0; char ch; int prct;
  32.  
  33. // Read File point Level.txt format 5324000000
  34.  
  35. FILE *fp;
  36.  
  37. if ((fp = fopen("Level.txt", "r")) ==NULL){
  38. printf("Error opening file\n");
  39. exit(1);
  40. }
  41. // where getc() is GroupStud
  42.  
  43. while (( ch= getc(fp)) !=EOF)
  44. {
  45. GroupStud[i]= ch; i++;
  46. }
  47. fclose(fp);
  48.  
  49. // Family Student for example
  50.  
  51. char NameStude[10][25] = {"Petrov","Ivanov","Sidorov",
  52. "Makarov","Belov","Kozlov",
  53. "Bobrov","Volkov","Kirov","Rozov"};
  54.  
  55. // Parameters for PIE
  56.  
  57. int stangle = 0; int endangle = 360;
  58. int radius = 100; int ballDegr= 360/50;
  59.  
  60. setfillstyle(1, 0);
  61. pieslice(midx, midy, stangle, endangle, radius);
  62.  
  63. // set fill style and draw a pie slice to 10 mens
  64.  
  65. for (int u=0; u<10; u++)
  66. {
  67. if (GroupStud[u]!='0')
  68. { ch= GroupStud[u]; prct= atoi(&ch)*ballDegr;
  69. setcolor(u+3);
  70. outtextxy(10, 30+u*30, "Student "); outtextxy(100, 30+u*30, NameStude[u]);
  71. char a[2]; a[0]= ch; a[1]='\0'; outtextxy(200, 30+u*30, a);
  72. setfillstyle(1, u+3);
  73. endangle= stangle + prct;
  74. pieslice(midx, midy, stangle, endangle, radius);
  75. stangle= endangle;
  76. }
  77. else {
  78. setcolor(15);
  79. outtextxy(10, midy+u*30, "Student ");
  80. outtextxy(100, midy+u*30, NameStude[u]);
  81. outtextxy(200, midy+u*30, " is bad job");
  82. }
  83.  
  84. }
  85.  
  86. getch();
  87. closegraph();
  88.  
  89. cout<<endl;
  90. SetConsoleTextAttribute(hConsole, (WORD) ((0 << 4) | 15));
  91. system("PAUSE");
  92. return EXIT_SUCCESS;
  93.  
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement