Using ''void'' just tells the compiler that this function does not return a result unlike :
int Add(int A, int B)
{
return A+B;
}
Unless DevC is different from normal your header files just end in ''.h'' not ''.hpp''.
I''d suggest getting hold of a good C/C++ book and reading through the first few chapters.
One I used is Tony Royce''s ''Programming in C'', coming from a basic/pascal background a few years ago.
,Jay
RPG Problems
I got a teach yourself c++ in 24 hours.....and why the darn is it that I have to use a c header file.....all well...thanx.
[edited by - Quantrizi on March 28, 2002 10:32:01 PM]
[edited by - Quantrizi on March 28, 2002 10:32:01 PM]
Ok, thanks. I could do that or something I just found out. If gamerunning = false, use the EOF; flag. Also, how do I pause the program until any key is pressed?
Thanks
Wheres the any key?
Thanks
Wheres the any key?
HibikiWheres the any key?www.geocities.com/dragongames123/home.html
find your elementat mutedfaith.com.<º>
find your elementat mutedfaith.com.<º>
enter this: system("PAUSE"); and if you want it to end, type: return 0; at the end. Here''s an example:
and don''t forget about the semicolon''s and the quotes.
#include <iostream>main(){ system ("PAUSE"); return 0;}
and don''t forget about the semicolon''s and the quotes.
*COUGH*stdlib*COUGH*
---START GEEK CODE BLOCK---GCS/M/S dpu s:+ a---- C++ UL(+) P(++) L+(+) E--- W++ N+ o K w(--) !O !M !V PS- PE+Y+ PGP+ t 5 X-- R tv+ b+ DI+ D G e* h! r-- !x ---END GEEK CODE BLOCK---
Ok, since I redid my whole source for my project, I need help with the voids. I have a void above the int main thing, and where the int main thing, I put void start(); *void start is the void above the int main() thing*, and nothing shows, if no one understands me, I''ll post the source*ain''t nothing much anyways*
Post ye code
---START GEEK CODE BLOCK---GCS/M/S dpu s:+ a---- C++ UL(+) P(++) L+(+) E--- W++ N+ o K w(--) !O !M !V PS- PE+Y+ PGP+ t 5 X-- R tv+ b+ DI+ D G e* h! r-- !x ---END GEEK CODE BLOCK---
#include <iostream.h>#include <fstream.h>#include <stdlib.h>#include <time.h>#include <windows.h>#include <conio.h>#include "class.h"#include "head.h"int answer;void start(){ cout << "Welcome to Fatal Consenquences. To get help on how"; cout << " to run this program, press 1 and hit enter, to start"; cout << " a new game, press 2 and hit enter, to load a game,"; cout << " press 3 and hit enter.\n"; cin >> answer; switch (answer){ case 1: cout << "Type in a number, unless stricted otherwise, and press enter.\n"; break; case 3: cout << "Sorry! No Loading System Up Yet!\n"; break; case 2: cout << "Got to get it set up, hold on!"; break; default: cout << "Invailid Input Value!"; break;if (answer == 1 || answer == 2 || answer == 3)void start(); };};int main(int argc, char *argv[]){ void start(); system("PAUSE"); return 0;}
I also got a void.h, class.h, but those ain't got nothing to do with the problem*note: in head.h, it just has void start();
[edited by - Quantrizi on March 28, 2002 8:55:54 PM]
Your return type is void. You do not type the return type when calling the function. void just means that you are not returning anything from the function. Just because you have a void return type, does not mean you call the function any differently.
I recommend getting a better book on C++. You might want to try Bruce Eckel's "Thinking in C++", which you can download for free here.
[edited by - SilentCoder on March 28, 2002 9:59:52 PM]
I recommend getting a better book on C++. You might want to try Bruce Eckel's "Thinking in C++", which you can download for free here.
[edited by - SilentCoder on March 28, 2002 9:59:52 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement