Sunday, October 7, 2018

Graphical Report - Project Demo


Project Demonstration - Graphical Reports 

This project shows how to generate Graphical Reports of Student's Class Test from "classtest.txt" data file without use of <graphics.h>. 

Assume classtest.txt file contains RollNo and MarksObtained by the students. This program will display horizontal BAR chart of the Marks obtained by the students.

#include<stdio.h>
int main()
{
  FILE *fp;
  int marks, i;
  const char str[80], s[2]=" ";
  char *token;

  fp = fopen("classtest.txt","r");

  if(fp == NULL) { printf("File error.."); exit(0); }

  system("color A1");
  printf("  Class Test Graphical Report(2018)\n");
  printf("=====================================\n");
  printf(" Roll No.| Marks Obtained (Out of 20)\n");
  printf("=====================================\n");

  while(fgets(str,80,fp)!=NULL)
  {
token = strtok(str,s);
printf("     %s   | ", token);
token = strtok(NULL, s);
marks = atoi(token);
for(i=0; i<marks; i++)
  printf("%c", 254);
printf(" %d\n", marks);
  }
  fclose(fp);
  return 0;    
}

Output of Program

Project Demonstration - Graphical Report of Student Class Test

Check more interesting projects here..


No comments:

Post a Comment