i have made an electricity bill program and wants to add graphics in it
mean when it need input from user it writes in graphics.............
so plz help me in making this.......

#include<stdio.h>
#include<conio.h>
#include<iostream.h>
void main()
{
int unit=3;
int reading,previous,current,consumed,bill;
cout<<"enter your meter no";
cin>>reading;
cout<<"enter previous redaing of meter";
cin>>previous;
cout<<"enter current reading of meter";
cin>>current;
consumed=current-previous;
cout<<"units used in this month="<<consumed<<endl;
bill=consumed*unit;
cout<<"total bill="<<bill<<"Rs";


	getch();

	closegraph();


}

Recommended Answers

All 4 Replies

You mean a GUI program? If MS-Windows you have to write a windows program, not a console program. Here is a simple introduction tutorial. It requires a basic knowledge/understanding of C ir C++ language.

I changed some bits but, hey, it works for me.
I use Dev-C++

Try this:

#include<stdio.h>
#include<conio.h>
#include<iostream>
#include<windows.h>

using namespace std;

int main()
{
int unit=3;
int reading,previous,current,consumed,bill;

      cout<< "Enter your meter Number:\a";
       cin>>reading;
      cout<<"Enter previous redaing of meter:\a";
       cin>>previous;
      cout<<"Enter current reading of meter:\a";
      cin>>current;
     consumed=current-previous;
      cout<<"Units used in this month="<<consumed<<endl;
      bill=consumed*unit;
      cout<<"Total bill="<<bill<<"Rs";


	getch();

	return 0;


}

Well 'graphics' is a bit vague, what sort of graphics?

Perhaps a thermometer, running from 'green' to 'red' depending on how much energy has been used.

Or perhaps a series of measurements plotted as a line graph.

Now, what do YOU mean by graphics?

graphics mean it should appear in differnt colours means it looks like origional electricity bill on screen thats what i mean .........look at this program i cannot able to print input from user in this page...plz help....

#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<graphics.h>
#include<iostream.h>
void main( )

{
	int gd = DETECT, gm, maxx, maxy;
	initgraph ( &gd, &gm, "c:\\tc\\bgi" ) ;
	maxx = getmaxx( ) ;
	maxy = getmaxy( ) ;
	rectangle ( 0, 0, maxx, maxy ) ;
	settextstyle(0,0,3);
	setcolor ( 10 ) ;

       outtextxy ( 250,50, "WAPDA" ) ;
       settextstyle(0,0,2);
	outtextxy (270,80,"LESCO");
	settextstyle (0,0,1);
	outtextxy(100,120,"METER NO");
settextstyle(0,0,2);
outtextxy(400,200,"SAVE ENERGY");
outtextxy(385,230,"SAVE PAKISTAN");

	getch ();
	closegraph();
	}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.