My C++ programs are not producing output.
The simplest ones like cout.
10 1963
What compiler/IDE do you use?
Banfa 9,065
Recognized Expert Moderator Expert
And give us an example of your non-working code.
- # include <iostream.h>
-
# include <fstream.h>
-
# include <conio.h>
-
# include <stdio.h>
-
#include <graphics.h>
-
#include<dos.h>
-
# include<process.h>
-
void mainmenu()
-
{ START:
-
int jk;
-
int gd=DETECT,gm;
-
initgraph(&gd,&gm,"c:\\tc\\bgi");
-
clrscr();
-
gotoxy(10,3);
-
cout<<"*********";
-
settextstyle ( 10,0,3);
-
setcolor(LIGHTBLUE+BLINK);
-
outtextxy(10,5,"WELCOME TO JABALPUR RTO");
-
gotoxy(10,7);
-
cout<<"*********";
-
delay(1000);
-
setcolor(YELLOW);
-
settextstyle(10,0,1);
-
outtextxy(50,25,"RTO SERVICES");
-
setcolor(LIGHTRED);
-
outtextxy(50,65,"1.LEARNER'S LICENSE");
-
setcolor(DARKGRAY);
-
outtextxy(50,105,"2.duplicate learners license");
-
setcolor(RED);
-
outtextxy(50,145,"3.permanent driving license");
-
setcolor(CYAN);
-
outtextxy(50,185,"4.duplicate driving licensce");
-
setcolor(GREEN);
-
outtextxy(50,225,"5.renew license");
-
setcolor(WHITE);
-
outtextxy(50,245,"REGISTERATION OF VEHICLES");
-
setcolor(MAGENTA);
-
outtextxy(50,265,"6.permanent registration");
-
setcolor(LIGHTGREEN);
-
outtextxy(50,285,"EXIT");
-
-
cout<<"NOTE:"<<endl;
-
-
cout<< " INFORMATION FOR THE USERS, ENTER YOUR";
-
-
cout<<" VOTER ID NO. ISTEAD OF PASSPORT SIZE PHOTO AS A PROOF"<<endl;
-
closegraph();
-
}
-
-
int z;
-
char x[35],y[35],fz[111],fv[111],fb[111],fc[111],reg[77];
-
void info()
-
{clrscr();
-
-
cout<<"enter NAME OF LICENSING AUTHORITY "<<endl;
-
cin>>x;
-
cout<<"enter licensce no."<<endl;
-
cin>>z;
-
cout<<"enter NAME OF licence AUTHORITY who";
-
-
cout<<" issued driving licence"<<endl;
-
cin>>y;
-
}
-
-
void vehiclemenu()
-
{ clrscr();
-
-
cout<<"1.enter the vehicle for which you are applying"<<endl;
-
cout<<"2.motor cycle without gear"<<endl;
-
cout<<"3.motor cycle with gear"<<endl;
-
cout<<"4.invalid carriage"<<endl;
-
cout<<"5.light motor vehicle"<<endl;
-
cout<<"6.transport vehicle"<<endl;
-
cout<<"7.road roller"<<endl;
-
cout<<"8.motor vehicle of specified description namely"<<endl;
-
}
-
-
class dates
-
{
-
public:int d1,d2,d3[5];
-
int t1,t2,t3[5];
-
int m1,m2,m3[5];
-
int p1,p2,p3[5];
-
int j1,j2,j3[5],k1,k2,k3[5];
-
-
-
-
void dob()
-
{
-
cout<<"enter date of birth"<<endl;
-
cin>> d1;
-
cout<<"enter month"<<endl;
-
cin>> d2;
-
cout<<"enter year"<<endl;
-
cin>> d3[5];
-
return ;
-
}
-
-
void todays()
-
{
-
cout<<"enter date"<<endl;
-
cin>>t1;
-
cout<<"enter month"<<endl;
-
cin>>t2;
-
cout<<"enter year"<<endl;
-
cin>>t3[5];
-
return ;
-
}
-
-
void doi()
-
{
-
cout<<"enter date of issue"<<endl;
-
cin>>m1;
-
cout<<"enter month"<<endl;
-
cin>>m2;
-
cout<<"enter year"<<endl;
-
cin>>m3[5];
-
return ;
-
}
-
-
void doex()
-
{
-
cout<<"enter date of expiry"<<endl;
-
cin>>p1;
-
cout<<"enter month"<<endl;
-
cin>>p2;
-
cout<<"enter year"<<endl;
-
cin>>p3[5];
-
return ;
-
}
-
-
void pur()
-
{
-
cout<<"enter date of purchase"<<endl;
-
cin>>k1;
-
cout<<"enter month"<<endl;
-
cin>>k2;
-
cout<<"enter year"<<endl;
-
cin>>k3[5];
-
return;
-
}
-
-
void dot()
-
{
-
cout<<"enter date of test"<<endl;
-
cin>>j1;
-
cout<<"enter month"<<endl;
-
cin>>j2;
-
cout<<"enter year"<<endl;
-
cin>>j3[5];
-
return ;
-
}
-
-
}date1,date2;
-
-
-
class AB
-
{public:
-
char nam[50];
-
char relation;
-
char padd[100];
-
char tadd[100];
-
int stay;
-
int dob;
-
char pob[35];
-
char m[5];
-
char edu[66];
-
char imark[77];
-
char bg[10];
-
int date;
-
char nam2[55];
-
void accdetails()
-
{
-
cout<<"enter your name"<<endl;
-
cin>>nam;
-
cout<<" enter son of/daughter of/wife of/"<<endl;
-
cin>>relation;
-
cout<<"enter permanent address"<<endl;
-
cin>>padd;
-
cout<<"enter temporary address"<<endl;
-
cin>>tadd;
-
cout<<"enter duration of sTAY at perm add"<<endl;
-
cin>>stay;
-
cout<<"enter PLACE OF BIRTH"<<endl;
-
cin>>pob;
-
cout<<"enter IF FROM OUTSIDE INDIA"<<endl;
-
cin>>m;
-
cout<<"enter EDUCATION QUALIFICATION"<<endl;
-
cin>>edu;
-
cout<<"enter IDENTIFICATION MARKS"<<endl;
-
cin>>imark;
-
cout<<"enter BLOOD GROUP"<<endl;
-
cin>>bg;
-
cout<<"enter NAME OF LICENSING AUTHORITY "<<endl;
-
cin>>nam2;
-
}
-
-
void shortdet()
-
{
-
cout<<"enter your name"<<endl;
-
cin>>nam;
-
cout<<"enter permanent address"<<endl;
-
cin>>padd;
-
cout<<"enter temporary address"<<endl;
-
cin>>tadd;
-
cout<<" enter son of/daughter of/wife of/"<<endl;
-
cin>>relation;
-
}
-
-
}app1,app2;
-
-
char g1[77],g2[77],g3[77];
-
void extradet1()
-
{
-
-
cout<<"NOTE: ENTER NIL FOR NOTHING"<<endl;
-
-
cout<<"particulars of driving license previously held by applicant";
-
-
cout<<",whether it was cancelled and if so, for what reason?"<<endl;
-
cin>>g1;
-
-
cout<<" have you been disqaulified for holding or obtaining";
-
-
cout<<" driving licence or learners licence ,if so for what reason"<<endl;
-
cin>>g2;
-
-
-
cout<<"particulars of driving license previously held by applicant ";
-
cout<<"in respect of description of vehicle to which the applicant";
-
cout<<" has applied"<<endl;
-
cin>>g3;
-
}
-
-
void extradet2()
-
{
-
char h1[77],h2[77],h3[77];
-
cout<<"NOTE: ENTER NIL FOR NOTHING"<<endl;
-
-
cout<<"have you previously held driving";
-
-
cout<<" licence 'if so give details"<<endl;
-
cin>>h1;
-
-
cout<<"particulars and date of every conviction which" ;
-
-
cout<<" has been ordered to be endorsed on any";
-
cout<<"licence held by applicant"<<endl;
-
-
cin>>h2;
-
-
cout<<"have you been diqaulifed for obtaining" ;
-
cout<<" a driving licence ,if so ,for what"<<endl;
-
cin>>h3;
-
}
-
-
-
class cd
-
{
-
public: char nam[50];
-
char relation;
-
char padd[100];
-
char tadd[100];
-
int age;
-
char mnam;
-
char veh[100];
-
char veht[100];
-
int yr[10],cyl,hp,cn,en,sc,uw,cc;
-
char clrds[33],fuel[33];
-
-
-
void accdets()
-
{
-
cout<<"enter your name"<<endl;
-
cin>>nam;
-
cout<<" enter son of/daughter of/wife of/"<<endl;
-
cin>>relation;
-
cout<<"enter permanent address"<<endl;
-
cin>>padd;
-
cout<<"enter temporary address"<<endl;
-
cin>>tadd;
-
cout<<"enter your age"<<endl;
-
cin>>age;
-
cout<<"enter makers name"<<endl;
-
cin>>mnam;
-
cout<<"class of vehicle"<<endl;
-
cin>>veh;
-
cout<<" type of body"<<endl;
-
cin>>veht;
-
cout<<"year of manufactre "<<endl;
-
cin>>yr[10] ;
-
cout<<"no. of cylinders"<<endl;
-
cin>>cyl;
-
cout<<"horse power"<<endl;
-
cin>>hp;
-
cout<<"chasis no."<<endl;
-
cin>>cn;
-
cout<<"engine no."<<endl;
-
cin>>en;
-
cout<<"seat capacity "<<endl;
-
cin>>sc;
-
cout<<"unladen capacity"<<endl;
-
cin>>uw;
-
cout<<" colour of vehicle "<<endl;
-
cin>>clrds;
-
}
-
}obj ;
-
-
void displayform1()
-
{
-
cout<<" learner licence form"<<endl;
-
cout<<"TO"<<endl;
-
cout<<"THE AUTHORITY:,"<<endl;
-
cout<<app1.nam2;
-
cout<<"vehicle type:"<<'\t';
-
cout<<
-
cout<<"name:";
-
cout<<app1.nam;
-
cout<<"son of/daughter of/wife of/:";
-
cout<<app1.relation<<endl;
-
cout<<"permanent address:";
-
cout<<app1.padd<<endl;
-
cout<<"temporary address:";
-
cout<<app1.tadd<<endl;
-
cout<<"duration of sTAY at perm add:";
-
cout<<app1.stay<<endl;
-
cout<<"PLACE OF BIRTH:";
-
cout<<app1.pob<<endl;
-
cout<<"IF FROM OUTSIDE INDIA:";
-
cout<<app1.m<<endl;
-
cout<<"EDUCATION QUALIFICATION:";
-
cout<<app1.edu<<endl;
-
cout<<"BLOOD GROUP:";
-
cout<<app1.bg<<endl;
-
cout<<" IDENTIFICATION MARKS:";
-
cout<<app1.imark<<endl;
-
cout<<"NAME OF LICENSING AUTHORITY:";
-
cout<<app1.nam2<<endl;
-
}
-
-
void SECOND()
-
{
-
cout<<"have you previously held driving ";
-
cout<<" licence 'if so give details:";
-
cout<<g1<<endl;
-
cout<<"particulars and date of every conviction which";
-
cout<<" has been ordered to be endorsed on any";
-
cout<<" licence held by applicant:";
-
cout<<g2<<endl;
-
-
cout<<"have you been diqaulifed for obtaining";
-
cout<<" a driving licence ,if so ,for what:";
-
-
cout<<g3<<endl;
-
}
-
-
void displayform2()
-
{cout<<"APPLICATION FORM FOR THE ISSUE OF DUPLICATE OF LEARNER'S DRIVING LICENCE"<<endl;
-
-
cout<<"TO"<<endl;
-
cout<<"THE LICENCE AUTHORITY"<<endl;
-
cout<<x<<endl;
-
-
-
cout<<"I here by apply for issue of duplicate of my learner's driving licence";
-
-
cout<<" no."<<z<<"issued by";
-
cout<<"the licence authority"<<y<<"on"<<date1.m1<<"-"<<date1.m2<<"-"<<date1.m3<<"and";
-
-
cout<<"expiring on\about"<<date1.p1<<"-"<<date1.p2<<"-"<<date1.p3<<endl;
-
-
}
-
-
-
-
void displayrenw( )
-
{cout<<"application form for the renewl of driving licence";
-
cout<<"i sri\smt kumari"<<fv<<" hereby apply for the renewal of my driving licence";
-
cout<<" particulars of which are as follows:" ;
-
-
cout<<"number";
-
cout<<z<<endl;
-
cout<<"date of issue";
-
cout<<date1.m1 <<"-"<<date1.m2 <<"-"<<date1.m3<<endl;
-
cout<<"licence AUTHORITY who ";
-
cout<<" issued driving licence";
-
cout<<y<<endl;
-
-
-
cout<<"class of vehicle authorised to be driven.";
-
cout<<fz<<endl;
-
cout<<"date of expiry";
-
cout<<date1.p1 <<"-"<<date1.p2 <<"-"<<date1.p3<<endl;
-
cout<<"address";
-
cout<<fb<<endl;
-
cout<<"date";
-
cout<<date1.t1 <<"-"<<date1.t2 <<"-"<<date1.t3<<endl;
-
-
}
-
-
void displaydup()
-
{cout<<"application form for duplicate driving licence"<<endl;
-
cout<<"TO"<<endl;
-
cout<<"THE LICENCE AUTHORITY"<<endl;
-
cout<<x;cout<<endl;
-
cout<<"i"<<app2.nam<<"permanent address"<<app2.padd<<"and temporary";
-
cout<<" address"<<app2.tadd<<"son of/daughter of/wife of/"<<app2.relation<<"hereby";
-
-
cout<<"report that licence no."<<z<<"issued by licence";
-
-
cout<<"authority "<<x<<"on"<<date1.m1<<"-"<<date1.m2<<"-"<<date1.m3<<"has been";
-
cout<<" lost/mutilated/desrtoyed"<<endl;
-
}
-
-
void disprgs()
-
{cout<<"the infor u hav entered is as follows"<<endl;
-
-
cout<<"to"<<endl;
-
cout<<"the registering authority"<<" "<< reg;
-
cout<<"full name of person to be registered as owner"<<" "<<obj.nam;
-
cout<<"age of person to be registered as owner"<<" "<<obj.age;
-
cout<<"permanent address"<<" "<<obj.padd;
-
cout<<"temporary address if any"<<" "<<obj.tadd;
-
cout<<"makers name"<<" "<<obj.mnam;
-
cout<<"class of vehicle"<<" "<<obj.veh;
-
cout<<"type of body"<<" "<<obj.veht;
-
cout<<"year of manufacture"<<" "<<obj.yr;
-
cout<<"no. of cylinders"<<" "<<obj.cyl;
-
cout<<"chasis no."<<" "<<obj.cn;
-
cout<<"engine no."<<" "<<obj.en;
-
cout<<"seat capacity"<<" "<<obj.sc;
-
cout<<"unladen capacity"<<" "<<obj.uw;
-
cout<<"colour of vehicle"<<" "<<obj.clrds;
-
-
cout<<"thank you for visiting rto madhya pradesh.com";
-
}
-
-
void main ()
-
{
-
clrscr();
-
int mk=9;
-
-
while(mk==9)
-
{
-
mainmenu();
-
int ch;
-
-
-
cout<<"ENTER YOUR CHOICE"<<endl;
-
cin>>ch;
-
switch(ch)
-
{
-
case 1: cout<<"LEARNER'S LICENSE"<<endl;
-
app1.accdetails();
-
extradet1();
-
date1.todays();
-
mk=++mk;void displayform1();
-
void SECOND();
-
break;
-
-
-
case 2: cout<<"duplicate learners license"<<endl;
-
info();
-
date1.todays();
-
date1.doi();
-
date1.doex();
-
cout<<"enter your name"<<endl;
-
cin>>fv;
-
mk=++mk; void displayform2();
-
break;
-
-
-
case 3: cout<<"permanent driving license"<<endl;
-
app1.accdetails();
-
extradet2();
-
date1.dot();
-
date1.todays();
-
mk=++mk; void diplayform1();
-
break;
-
-
-
case 4: cout<<"duplicate driving licensce"<<endl;
-
info();
-
date1.todays();date1.doi();
-
app2.shortdet();
-
mk=++mk;void displaydup();
-
break;
-
-
-
case 5 : cout<<"renew license"<<endl;
-
info();
-
date1.doi();
-
date1.doex();
-
date1.todays();
-
vehiclemenu();
-
cin>>fz;
-
cout<<"enter your name"<<endl;
-
cin>>fv;
-
cout<<"enter your present address"<<endl;
-
cin>>fb;
-
mk=++mk;void displayrenw();
-
break;
-
-
-
case 6: cout<<"permanent registration"<<endl;
-
obj.accdets();
-
-
cout<<"enter the name of the registering authority"<<endl;
-
cin>>reg;
-
date1.todays();
-
date1.pur();
-
mk=++mk;void dispprgs();
-
break;
-
case 7:int gd=DETECT,gm;
-
initgraph(&gd,&gm,"c:\\tc\\bgi");
-
setbkcolor(0);
-
delay(1000);
-
setcolor(MAGENTA);
-
settextstyle(4,0,4);
-
outtextxy(5,70,"A PROJECT BY:");
-
delay(1500);
-
settextstyle(8,0,4);
-
setcolor(YELLOW);
-
outtextxy(10,170,"* TAPAS JAIN");
-
delay(1000);
-
settextstyle(8,0,4);
-
setcolor(BLUE);
-
outtextxy(10,320," ON RTO SERVICES");
-
delay(1000);
-
settextstyle(4,0,4);
-
setcolor(RED);
-
outtextxy(350,70,"GUIDED BY");
-
delay(1000);
-
settextstyle(8,0,4);
-
setcolor(GREEN);
-
outtextxy(350,190,"MRS SHARAD SINGH");
-
delay(3500);
-
exit(0);
-
break;
-
-
default: cout<<"irrelevant no. entered"<<endl;
-
mk=++mk;
-
break;
-
-
}
-
-
cout<<"if you want to repeat the process enter '9' "<<endl;
-
cin>>mk;
-
-
-
}
getche();
};
this code
reply me soon
plzzzzzzzzzzzzzzzzzzzzzzzzzz
Try a simple program first: - int main()
-
{
-
cout << "Hello world!" << endl;
-
}
and be sure the cout works.
Then add only a little of your logic and compile again. Run that code an be sure it works. Then add a little more code.
By working gradually you will always have a running program. When it fails to work, the error will probably be in the code you just added.
What about IDE and compiler, still?
initraph() hints about borland C. Dev-c++ or original Borland?
( btw, blink attribute doesn't work in graphics mode)
I don't see any using std::cout or using namespace std in there... maybe that's it?
If its Borland or Turbo C++ no need of std::cout.
Anyway the description of problem is too small... And have you tried the simple program as told by weaknessforcats.?
Regards
Dheeraj Joshi
ashitpro 542
Recognized Expert Contributor
If even that small program doesn't work. try adding fflush(stdout); after cout statement.
What do you see when you run this program: - int main()
-
{
-
cout << "Hello world!" << endl;
-
}
Maybe a black window flashes by? If so, that was your program executing. You may need a pause at the end of main().
Many times in case of Turbo C compiler, output window gets closed by itself ; try using getch() so that the output window will wait untill a charachter is accepted by it.. or you can also check output window in Windows options in case of TC/TC++ compilers
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Todd |
last post by:
I am somewhat new to ASP.NET and I am probably overlooking some basic
rule that's causing my error. Anyways, here's the scoop: I am using
a DataReader to access a SQL stored procedure. I want...
|
by: MattC |
last post by:
Hi,
I am developing a timesheet system that collects information about employees
activities. In this I collect details about projects they do work for, what
type of work, how long, when etc...
|
by: Jed Parsons |
last post by:
Hi,
I'm using the logging module for the first time. I'm using it from
within Zope Extensions.
My problem is that, for every event logged, the logger is producing
multiple identical entries...
|
by: Andy Holyer |
last post by:
We're producing a commercial intranet application using Mason, and we
need to produce a room booking system, which needs displays by day,
week, and month at-a-time.
I've started on twiddling...
|
by: Helmut Giese |
last post by:
Hello out there,
this is OT but maybe some of you were in the past faced with the same
problem: I have lots of sequences of GIF files to combine into
animated GIFs. I can do it 'by hand' with...
| |
by: john sun |
last post by:
Hi, Dear gurus,
In the web deployment project, there is one option called "Output
Assemblies page".
The first choice is "Merge all outputs to a single assembly", According
to MSDN,
"Merges...
|
by: TheServant |
last post by:
Hey guys,
I have an untraining script in my game which I am having a small problem with. There are 4 levels of soldiers: rec, reg, exp and vet. Now the number of soldier is recorded as the total, so...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |