473,394 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

have 3 errors could not able to find it can some help finding them

this my pgm
can anyone help me finding my errors
#include<iostream.h>
#include<stdlib.h>
#include<conio.h>
#include<stdio.h>
struct ques
{ char a[100];
char ans;
} q[20];
void menu();
void startquiz(ques q[20]);
void add(ques q[20]);
void rem(ques q[20]);
void leveltwo(ques q[20],int score);

void main()
{
clrscr();
int ch,z,n;
q[1].a[100]={"1.the capital of honduras is: A.Tegucigalpa B.Port Louis C.Kingston";}
q[2].a[100]={"2.who won the nobel prize for physics in 2013? A.Jane Goodall B.Peter Higgs and Francois Elgort C.Alan Aspect";}
q[3].a[100]={"3.who is the vice president of USA? a.Joe biden b.Hilary clinton c.Mike pence";}
q[4].a[100]={"4.Triskaedophobia is the fear of________ A.Mirrors B.Beards C.Number 13";}
q[5].a[100]={"5.which of these was the first e-commerce company?A.Alibaba B.Amazon C.Snapdeal ";}
q[6].a[100]={"6.who is the father of internet? A.Vinton Cerf B.Charles Babbage C.Marconi ";}
q[7].a[100]={"7.who is the CEO of twitter? A.Merissa Mayer B.Jack Dorsey C.Steve Jobs";}
q[8].a[100]={"8.who is the founder of amul? A.Mohammad Younas B.Vinoba Bhave C.Varghese Kurian";}
q[9].a[100]={"9.what was the word of the year 2013? A.Selfie B.Thug C.Swag ";}
q[10].a[100]={"10.the olive leaf represents what symbol? A.Humanity B.Victory C.Peace";}
q[11].a[100]={"11.which game is associated with yonex cup? A.Golf B.Baseball C.Batminton";}
q[12].a[100]={"12. Who invented the electric razor? A.K.G Gillete B. Col.J.Schick C. L.C Young";}
q[13].a[100]={"13. When was Abraham Lincoln re-elected as the president of US? A.1864 B. 1814 C.1819";}
q[14].a[100]={"14. Which mirror is used as rear view mirror in vehicles? A.Plain B.Concave C.Convex";}
q[15].a[100]={"15. Former prime minister Charan singh was related to which political party? A.Lok Dal B. AIADMK C.Janata Dal ";}
q[16].a[100]={"16. How many centuries did Sachin score against Kenya? A.2 B.4 C.3";}
q[17].a[100]={"17.Who is known as the 'Father of Geometry'?A.Kepler B.Euclid C.Pythagoras";}
q[18].a[100]={"18.What is October 8th celebrated for? A.Army Day B.U.N.O Day C.Airforce Day";}
q[19].a[100]={"19.18 carat gold contains? A.18% gold B.60% gold C.75%gold";}
q[20].a[100]={"20.What is the National Emblem of Denmark A.Beach B.Rose C.Lily";}
cout<<"******************************************* ***";
cout<<" ******************************************** ";
cout<<" **************************************** ";
cout<<" ************************************ ";
cout<<" ******************************** ";
cout<<" **************************** ";
cout<<" ************************ ";
cout<<" ******************** ";
cout<<" **************** ";

cout<<" QUIZ ";

cout<<" **************** ";
cout<<" ******************** ";
cout<<" ************************ ";
cout<<" **************************** ";
cout<<" ******************************** ";
cout<<" ************************************ ";
cout<<" **************************************** ";
cout<<" ******************************************** ";
cout<<"******************************************* ***";
cout<<"\nENTER YOUR CHOICE(1-3)";
cin>>ch;
do
{
switch(ch)
{
case 1: cout<<"\n1.Add more questions\n2.Remove questions\n3.Return to main menu";
cin>>n;
if(n==1)
add(q);
else if(n==2)
rem(q);
else
menu();
break;
case 2: cout<<"\n1.Start Quiz\n2.Return to main menu";
cin>>z;
if(z==1)
startquiz(q);
else
menu();
break;
case 3: exit(0);
break;
default:cout<<"\nWRONG CHOICE";
break;
}
}while(ch!=0);
getch();

}
void startquiz(ques q[20])
{
char ans[5];
int score =0;
cout<<"\n"<<"please read the following instructions to continue the quiz";
clrscr();
cout<<"******************************************* *********";
cout<<"\n"<<"WELCOME TO THE QUIZ GAME";
cout<<"\n you will be asked a question and three options will be given with it";
cout<<"\n each correct answer gets 10 points and a wrong answer means no points";
cout<<"\n ************************************************** **";
cout<<"\n YOU WILL NOW START THE QUIZ";
clrscr();
for(int i=1;i<11;i++)
{
cout<<"\n"<<"QUESTION"<<i;
cout<<"\n"<<q[i].a[100];
cout<<"\n"<<"enter answer(a,b or c)";
cin>>q[i].ans;
clrscr();
}
if(q[1].ans=='a')
score+=10;
if(q[2].ans=='b')
score+=10;
if(q[3].ans=='a')
score+=10;
if(q[4].ans=='c')
score+=10;
if(q[5].ans=='a')
score+=10;
if(q[6].ans=='a')
score+=10;
if(q[7].ans=='b')
score+=10;
if(q[8].ans=='c')
score+=10;
if(q[9].ans=='a')
score+=10;
if(q[10].ans=='c')
score+=10;
clrscr();
if(score>=60)
leveltwo(q,score);
else
{
cout<<"YOUR SCORE IS"<<score;
cout<<"\n"<<"unfortunately.you have not passed to level 2 of the game";
cout<<"\n"<<"************************************* *******************";
cout<<"\n"<<"GAME OVER!!!";
exit(0);
}

void leveltwo(ques q[20],int score);
{
clrscr();
char ans;
cout<<"\nNOW YOU ARE IN LEVEL TWO";
cout<<"\nLets Continue";
for(int i=11;i<21;i++)
{
cout<<"\n"<<"QUESTION"<<i;
cout<<"\n"<<q[i].a[100];
cout<<"\n"<<"enter answer a,b or c";
cin>>q[i].ans;
clrscr();
}
if(q[11].ans=='c')
score+=10;
if(q[12].ans=='b')
score+=10;
if(q[13].ans=='a')
score+=10;
if(q[14].ans=='c')
score+=10;
if(q[15].ans=='a')
score+=10;
if(q[16].ans=='b')
score+=10;
if(q[17].ans=='b')
score+=10;
if(q[18].ans=='c')
score+=10;
if(q[19].ans=='c')
score+=10;
if(q[20].ans=='a')
score+=10;
cout<<"******************************************* ***********";
cout<<"CONGRATULATIONS....YOUR SCORE IS"<<score;
}
void rem(ques q[100])
{
int c=0,p,loc,k,i;
cout<<"Enter the question number of the question you wish to delete"<<"\n";
cin>>(ques.a);
cout<<"enter the location you want to delete the question from";
cin>>loc;
for(i=0;st[ques.a]!='\0';i++)
c++;
k=c;
p=c-1;
for(i=loc;i<p;i++)
q[i]=q[i+1];
k--;
cout<<"final display";
for(i=0;i<k;i++)
cout<<q[i]<<"\t";
}
void add (ques q[100])
{
char inst;
int n;
cout<<"enter the question number";
cin>>n;
cout<<"enter question to be inserted" ;
gets(ques.a);
cout<<"\n"<<"enter answer";
cin>>(inst.ans);
for(int i=n;i<n+1;i--)
q[i]=q[i-1];
q[n]=inst;
}
void menu()
{
cout<<"\nMENU";
cout<<"\n1.Admin Menu";
cout<<"\n2.User Menu";
cout<<"\n3.Exit";
}
Jan 16 '17 #1
1 948
donbock
2,426 Expert 2GB
It would be a lot easier to help you if you enclosed your source code in CODE tags. Then there would be line numbers so we could refer to specific lines.

You are using C++. My understanding is that standard headers in C++ don't end in .h.

An array of size N is referenced by indices 0 to N-1. You are using indices 1 to N.

Don't know about C++, but C doesn't let you simply assign a quote-enclosed string to a char array.
Jan 17 '17 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: jkarp2 | last post by:
Ok. Here's the problem: I am making a website, and want to be able to update news without having to go through the hassle of changing the page in Dreamweaver and uploading it via FTP. So I...
6
by: Mike | last post by:
Hi, I teach a VB .NET class, and one of the students obviously cheated on the final exam (which was to write a Tic Tac Toe game). They were smart enough to change all of the variables from the...
3
by: aam | last post by:
Hi. I am trying to find the cursor coordinates inside of a window, not a form. I would like to display the coordinates of the cursor when you click inside of the window. Either that, or have the...
9
by: dave m | last post by:
I need to be able to retrieve a unique ID from a users PC. I needs to be something a user could not easily change, like the computer name. Could someone point me in the right direction to find ...
0
by: daD | last post by:
Does anyone have any utilities to help with dashboard/switchboard designs?
20
by: ridergroov | last post by:
I had this message previously in another group and I was told to try here. Hopefully someone can help out. Site was created in Dreamwaver MX 04 and I cna't figure out why there are so many errors...
11
by: Bob | last post by:
Hello, I am not a js programmer, but i was hoping to find a prewritten script that i may be able to use. all i need is a simple count up timer that has a start, pause, and stop control to it, i...
10
by: salty | last post by:
.... when no one here has an answer? Does MS offer support for its programming products where that support doesn't cost an arm and a leg, but where you can at least get a response? I'm not...
14
by: Jeff | last post by:
Hello I'm teaching myself web programming in ASP.NET using freely available online resource and videos. It's going really well and I've built myself some personal web pages based on the Visual...
5
by: David Morris | last post by:
I keep getting this syntax error in one of my webpages and I have looked through it and I can't find it. Its not my includes because they work fine on my other pages. Please Help! Parse error:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.