Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- #include <graphics.h>
- #include <winbgim.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <cstdio>
- using namespace std;
- int main(int argc, char *argv[])
- {
- /* initialize graphics window at 300 x 300 */
- initwindow(400, 700,"Student Level", 500,200);
- HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
- setcolor(15);
- outtextxy(5, 5, "Graphic by BGIM for Windows");
- int midx, midy;
- midx = getmaxx() / 2;
- midy = getmaxy() / 2;
- // Points of the student
- char GroupStud[11];
- // Variable for read file and any work
- int i=0; char ch; int prct;
- // Read File point Level.txt format 5324000000
- FILE *fp;
- if ((fp = fopen("Level.txt", "r")) ==NULL){
- printf("Error opening file\n");
- exit(1);
- }
- // where getc() is GroupStud
- while (( ch= getc(fp)) !=EOF)
- {
- GroupStud[i]= ch; i++;
- }
- fclose(fp);
- // Family Student for example
- char NameStude[10][25] = {"Petrov","Ivanov","Sidorov",
- "Makarov","Belov","Kozlov",
- "Bobrov","Volkov","Kirov","Rozov"};
- // Parameters for PIE
- int stangle = 0; int endangle = 360;
- int radius = 100; int ballDegr= 360/50;
- setfillstyle(1, 0);
- pieslice(midx, midy, stangle, endangle, radius);
- // set fill style and draw a pie slice to 10 mens
- for (int u=0; u<10; u++)
- {
- if (GroupStud[u]!='0')
- { ch= GroupStud[u]; prct= atoi(&ch)*ballDegr;
- setcolor(u+3);
- outtextxy(10, 30+u*30, "Student "); outtextxy(100, 30+u*30, NameStude[u]);
- char a[2]; a[0]= ch; a[1]='\0'; outtextxy(200, 30+u*30, a);
- setfillstyle(1, u+3);
- endangle= stangle + prct;
- pieslice(midx, midy, stangle, endangle, radius);
- stangle= endangle;
- }
- else {
- setcolor(15);
- outtextxy(10, midy+u*30, "Student ");
- outtextxy(100, midy+u*30, NameStude[u]);
- outtextxy(200, midy+u*30, " is bad job");
- }
- }
- getch();
- closegraph();
- cout<<endl;
- SetConsoleTextAttribute(hConsole, (WORD) ((0 << 4) | 15));
- system("PAUSE");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement