DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C++ (http://www.daniweb.com/forums/forum8.html)
-   -   need serious help!!!!!! (http://www.daniweb.com/forums/thread123056.html)

nabeelcool17 May 7th, 2008 7:18 pm
need serious help!!!!!!
 
1 Attachment(s)
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();


}

Ancient Dragon May 7th, 2008 7:38 pm
Re: need serious help!!!!!!
 
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.

Dannyo329 May 8th, 2008 6:58 am
Re: need serious help!!!!!!
 
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;


}

Salem May 8th, 2008 5:08 pm
Re: need serious help!!!!!!
 
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?

nabeelcool17 May 11th, 2008 6:30 am
Re: need serious help!!!!!!
 
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();
        }


All times are GMT -4. The time now is 2:34 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC