hey, im trying to program a game that lets you buy weapons and sell them on and stuff. obviously more complicated than that but you get my drift. im getting a few errors i cant fix.
function 'glock17' should have a prototype (32)
type mismatch in redeclaration of 'glock17' (106)
misplaced else (149)
misplaced else (159)
function 'weaponm' should have a prototype (190)
cant find anything on prototypes that i can understand
heres the source: -
#include<conio.h>
-
#include<stdio.h>
-
int glock;
-
int glockinv;
-
int suitcase,cash,buysell;
-
-
-
-
-
void glock17()
-
{
-
char howmuch;
-
int glocktemp,glockinv;
-
-
-
printf("would you like to buy(1) or sell(2) some glock17's?\n\n");
-
scanf("%c",&buysell);
-
if(buysell=1)
-
printf("\nHow many would ya like?");
-
{
-
scanf("%i",&glocktemp);
-
if(glocktemp>200)
-
{
-
printf("\nYou cant buy that much\n");
-
getchar();
-
glock17();
-
}
-
-
else if(glocktemp=0)
-
{
-
void weaponsmark();
-
getchar();
-
glock17();
-
}
-
-
else if(cash<(glocktemp*50)
-
{
-
printf("\nYou Don't have enough money");
-
getchar();
-
glock17();
-
}
-
else
-
{
-
glockinv=weapontemp;
-
suitcase=suitcase-glockinv;
-
cash=cash-(glocktemp*50)
-
printf("\nYou have just bought %i Glocks for %i",glockinv,glocktemp);
-
printf("\nYou have %i glock and %i space left",glockinv, suitcase);
-
getchar();
-
clrscr();
-
weaponsmark();
-
}
-
}
-
else
-
{
-
if (glockinv>1)
-
-
printf("\nHow many would you like to sell?");
-
scanf("%i,"&drugtemp);
-
cash=cash+(glockinv*50)
-
printf("\nYou sold %i's worth of Glocks");
-
glockinv=glockinv-drugtemp;
-
}
-
else
-
Printf("\nyou don't have any Glocks!")
-
weaponsmark();
-
}
-
}
-
-
-
void suitcasefunc()
-
{
-
suitcase=200;
-
}
-
void cashfunc()
-
{
-
cash=50000
-
}
-
-
-
-
-
-
-
-
void weaponsmark()
-
-
char weaponm;
-
-
do
-
{
-
-
printf("\n\t\t a.Buy Glock 17 (Handgun)");
-
printf("\n\t\t b.Buy M9 (Shotgun)");
-
printf("\n\t\t c.Buy MP7 (Sub Machine Gun)");
-
printf("\n\t\t d.Buy M4 (Rifle)");
-
printf("\n\t\t e.Buy SV210 (Sniper Rifle)");
-
printf("\n\t\t f.Buy Barret 50 .cal (Armor Piercing Rifle)");
-
printf("\n\t\t g.Buy M203 (Grenade Launcher)");
-
printf("\n\t\t h.Buy LAW 24 (Rocket Launcher)");
-
printf("\n\t\t i.Buy Torque Bow (sticky bombs)");
-
printf("\n\t\t j.Buy Nuke");
-
printf("\n\t\t k.Buy Hammer Of Dawn (ION Cannon)");
-
printf("\n\nWeapon Dealer: What kind of boom stick would you like
-
today, sir?");
-
weaponm=getchar();
-
-
switch(weaponm)
-
{
-
-
case 'a':glock17();
-
break;
-
/* case 'b':m9();
-
break;
-
case 'c':mp7();
-
break;
-
case 'd':m4();
-
break;
-
case 'e':sv210();
-
break;
-
case 'f':barret();
-
break;
-
case 'g':m203();
-
break;
-
case 'h':law24();
-
break;
-
case 'i':torque();
-
break;
-
case 'j':nuke();
-
break;
-
case 'k':ION();
-
break; */
-
case 'l':break;
-
-
default: printf("\n Invalid Menu Choice");
-
getchar();
-
}
-
}
-
while(weaponm!='l');
-
printf("\nGoodbye");
-
getchar();
-
}
-
-
-
/*void startmenu()
-
{
-
char choice;
-
-
do
-
{
-
clrscr();
-
printf("\n\t\t d.Drugs Market");
-
printf("\n\t\t w.Weapons Market");
-
printf("\n\t\t b.Buy Upgrade");
-
printf("\n\t\t v.View Stats");
-
printf("\n\t\t f.Fly");
-
printf("\nEnter Choice");
-
choice=getchar();
-
-
switch(choice)
-
{
-
-
case 'a':printf("\n\nnumber1");
-
getchar();
-
break;
-
-
case 'b':printf("\n\nnumber2");
-
getchar();
-
break;
-
-
case 'c':break;
-
-
default: printf("\n Invalid Menu Choice");
-
getchar();
-
}
-
}
-
while(choice!='c');
-
printf("\nGoodbye");
-
getchar();
-
}
-
-
*/
-
void main()
-
{
-
cashfunc();
-
suitcasefunc();
-
weaponsmark();
-
weaponm();
-
}
-
-
-
thanks in advance
1 1133
So that's just saying that you need to declare those functions you create. For instance, if I want to create a function that changes celsius to farenheit, it would look something like: -
float celsiusToFarenheit(float faren) {
-
float cel = (5/9) * (faren-32);
-
return cel;
-
}
-
However, the compiler needs the prototype to be able to read it, so you would also need to include: -
float celsiusToFarenheit(float faren);
-
Best practice dictates putting this by your headers (though I've never played around with the declarations - I'm not sure it's entirely necessary).
So, for C++: -
include <iostream>
-
using namespace std;
-
float celsiusToFarenheit(float faren);
-
int main()
-
{
-
float temp;
-
cout << "Enter a temp: ";
-
cin >> temp;
-
cout << "The Celsius equivalent is: " << celsiusToFarenheit(temp) << endl;
-
return 0;
-
}
-
-
float celsiusToFarenheit(float faren) {
-
float cel = (5/9) * (faren-32);
-
return cel;
-
}
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: mike |
last post by:
Hello,
After trying to validate this page for a couple of days now I was
wondering if someone might be able to help me out. Below is a list of
snippets where I am having the errors.
1. Line 334,...
|
by: John Flynn |
last post by:
hi all
i'm going to be quick i have an assignment due which i have no idea how to
do. i work full time so i dont have the time to learn it and its due date
has crept up on me ..
As follows:...
|
by: xunling |
last post by:
i have a question about answering ..... this topic is "need help"
what do i have to write at te topic line, !after i have klicked the
"answer message" button
ive tried many possibilities,...
|
by: sk |
last post by:
I have an applicaton in which I collect data for different parameters
for a set of devices. The data are entered into a single table, each
set of name, value pairs time-stamped and associated with...
|
by: Timothy Shih |
last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I
wrote a simple function which takes in 2 buffers (one a byte buffer, one a
char buffer) and copies the contents of the byte...
|
by: Cheryl Langdon |
last post by:
Hello everyone,
This is my first attempt at getting help in this manner. Please
forgive me if this is an inappropriate request.
I suddenly find myself in urgent need of instruction on how to...
|
by: pamelafluente |
last post by:
I am still working with no success on that client/server
problem. I need your help. I will submit simplified versions
of my problem so we can see clearly what is going on.
My model:
A client...
|
by: skumar434 |
last post by:
i need to store the data from a data base in to structure
.............the problem is like this ....suppose there is a data base
which stores the sequence no and item type etc ...but i need only...
|
by: U S Contractors Offering Service A Non-profit |
last post by:
Brilliant technology helping those most in need Inbox
Reply
U S Contractors Offering Service A Non-profit
show details
10:37 pm (1 hour ago)
Brilliant technology helping those most in need ...
|
by: mike |
last post by:
I help manage a large web site, one that has over
600 html pages... It's a reference site for ham radio
folks and as an example, one page indexes over
1.8 gb of on-line PDF documents.
The site...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
| |