Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
The program will take the input from the user for the course name and obtain marks. After taking the 6 inputs the program will draw a bar chart by labeling the bars of the bar chart according to the subject name.
The title bar of the graphic window must show your student ID.


What I have tried:

#include <graphics.h>
#include <conio.h>
#include <iostream>
 
 using namespace std;

int main()
{
    string Subject1, Subject2, Subject3;
    int number1, number2, number3;
    cout<<"Enter the First Subject::";
    cin>>Subject1;
    cout<<"Enter the Number of Subject::";
    cin>>number1;
    cout<<"Enter the Second Subject::";
    cin>>Subject2;
    cout<<"Enter the Number of Subject::";
    cin>>number2;  
    cout<<"Enter the Third Subject::";
    cin>>Subject3;
    cout<<"Enter the Number of Subject::";
    cin>>number3;
   
    int gd = DETECT, gm;
    initgraph ("&gd, "&gm, "X:\\TC\\BGI);

    settextstyle(BOLD_FONT,HORIZ_DIR,2);
    outtextxy(275,0,"Bc--------");
    //here add your student id
    
	setlinestyle(SOLID_LINE,0,2);
    /*Draw on X and on Y Axis*/
    line (90,400,90,50);
    line(580,400,90,400);
    outtextxy(65,25,"Marks");
    outtextxy(40,70,"100-");
    outtextxy(595,385,"Subjects");

   /*Draw bars on screen*/
    setfillstyle(SOLID_FILL,GREEN);
    bar3d(150,150,200,400,15,1);
    bar3d(300,120,350,400,15,1);
    bar3d(450,135,500,400,15,1);
 
    getch();
    closegraph();
    return 0;
    }
Posted
Updated 11-Dec-22 10:48am
Comments
Rick York 11-Dec-22 19:38pm    
Do you have a question?

While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
And the code you show has almost nothing to do with the question you were set...

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 
The program is tagged as C++, but the includes as well as the graphics commands used indicate a very special version. It would help if it were specified here exactly what it is, under which operating systems it is supposed to run. Also missing is the information what the problem is here and where help is needed.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900