Author |
Learning some basic C++ |
Ignorance Grand Admiral
Joined: October 27, 2012 Posts: 85
| Posted: 2013-02-21 19:54  
So after applying what Boolean said. This is the resulting code. I added the wait(); to the code before the return 0; but it says that there is an error. :
#include
#include
using namespace std;
int main()
{
char letter; letter='A';
int number; number=100;
float decimal=7.5;
double pi= 3.14159;
bool isTrue=false
;cout<< "char letter: " << letter << endl;
cout<< "int number: " << number << endl;
cout<< "float decimal: " << decimal << endl;
cout<< "double pi: " << pi << endl;
cout<< "bool isTrue: " << isTrue << endl;
wait();
return 0;
}
void wait()
{
cout << "Press ENTER to continue...";
cin.ignore( numeric_limits ::max(), ' ' );
}
Makes no sense to me...
_________________ Lt. Commander Data: \"In the game of poker, there is a moment when a player must decide if an opponent is being deceptive, or actually holds a winning hand.\"
|
Forger of Destiny Chief Marshal We Kick Arse
Joined: October 10, 2009 Posts: 826
| Posted: 2013-02-21 23:13  
using functions 101 : have either a function definition OR a prototype before yo main (or whichever other function tries to call some other function first).
put this on the line before int main()
void wait(); /* <-- thats a prototype for the wait() as defined in your program */
the other way around it is to copypaste the wait() function as a whole to the line above int main()
Edit: a question - what if i want to call Func1, which calls Func2, which calls Func1 again (and lets say the calls continue recursively till some condition is fulfilled)?
complete function definitions would obviously fail, so should i write the prototypes of func1&2 just like they are, or do i need to use some trick? [ This Message was edited by: Mike Paradox on 2013-02-21 23:26 ]
_________________ Forging legends and lives outside till naught remains inside.
|
Null Pointer Grand Admiral Templar Knights
Joined: April 10, 2010 Posts: 148
| Posted: 2013-02-22 08:19  
In english:
Alright, so to you the program makes sense. But to your compiler its like "wtf, i never saw a wait(); function, they must have messed up" and throws an error. To fix this, you must tell the compiler that there is a function called "wait()" by adding "void wait();" after "using namspace std;". This let's the compiler know that there is a function called "wait()" but it is later on down the line, so it doesn't freak out and trust's that you have made one. Or, like Mike said, you can put this function before main().
_________________
|
Ignorance Grand Admiral
Joined: October 27, 2012 Posts: 85
| Posted: 2013-02-22 16:05  
Ahh ok. Thanks for speaking english. No offense Mike.
_________________ Lt. Commander Data: \"In the game of poker, there is a moment when a player must decide if an opponent is being deceptive, or actually holds a winning hand.\"
|
Forger of Destiny Chief Marshal We Kick Arse
Joined: October 10, 2009 Posts: 826
| Posted: 2013-02-22 22:07  
its cool, i speak c++
did you know c++ is a language?:D
_________________ Forging legends and lives outside till naught remains inside.
|
Ignorance Grand Admiral
Joined: October 27, 2012 Posts: 85
| Posted: 2013-02-23 09:28  
Yeah. Well, I knew it was a computer language thats only 43 years old.
_________________ Lt. Commander Data: \"In the game of poker, there is a moment when a player must decide if an opponent is being deceptive, or actually holds a winning hand.\"
|
Ignorance Grand Admiral
Joined: October 27, 2012 Posts: 85
| Posted: 2013-02-23 12:44  
Do you have to become a developer to be able to actually test your own stuff within the code of DS? I saw this "localserver" application in the DarkSpace folder, is that what I have to use?
_________________ Lt. Commander Data: \"In the game of poker, there is a moment when a player must decide if an opponent is being deceptive, or actually holds a winning hand.\"
|
| Dark Hiigaran | Chief Marshal
Joined: July 07, 2007 Posts: 426 From: Slovenia (Europe)
| Posted: 2013-02-23 13:18  
Quote:
|
On 2013-02-23 12:44, Ignorance[Helper] wrote:
Do you have to become a developer to be able to actually test your own stuff within the code of DS? I saw this "localserver" application in the DarkSpace folder, is that what I have to use?
|
|
i dont think you can do anything with the files we all have.
you can download darkspace's game engine but dont ask me how to use it.
i would like to know how to use it ...
Medusa [ This Message was edited by: | Dark Hiigaran | on 2013-02-23 13:20 ]
_________________
|
JBud Marshal
Joined: February 26, 2008 Posts: 1900 From: Behind you.
| Posted: 2013-02-25 05:50  
Quote:
|
On 2013-02-23 13:18, | Dark Hiigaran | wrote:
Quote:
|
On 2013-02-23 12:44, Ignorance[Helper] wrote:
Do you have to become a developer to be able to actually test your own stuff within the code of DS? I saw this "localserver" application in the DarkSpace folder, is that what I have to use?
|
|
i dont think you can do anything with the files we all have.
you can download darkspace's game engine but dont ask me how to use it.
i would like to know how to use it ...
Medusa
[ This Message was edited by: JBud on 2013-02-25 05:51 ]
|
| The game engine has no content, however. Building the content is another story entirely. This would be a much better start for a more advanced user. For now, I recommend doing more testing on your own. DarkSpace has some very advanced programming to it, and it is hard to understand
When I have some time, I may put together some simple*ish* examples on how to build content for the engine.
_________________ [-Point Jumper-][-Privateer Elite-][-Summus Dux-][-Praeclarae-]
[img(RIP MY SIGNATURE DELETED AFTER 7 YEARS/img]
''Insisto Rector - Suivez le Guide - Tempus hostium est''
|
Pantheon Marshal Palestar
Joined: May 29, 2001 Posts: 1789
| Posted: 2013-02-25 08:51  
Quote:
|
On 2013-02-23 12:44, Ignorance[Helper] wrote:
Do you have to become a developer to be able to actually test your own stuff within the code of DS? I saw this "localserver" application in the DarkSpace folder, is that what I have to use?
|
|
Yes, you do. Mainly for security reasons. Whilst the game is pretty much unhackable, you can still glaze over edge case scenarios which would allow someone to exploit a particular part of the game.
It's safer just to lock down the code and give access to those who we trust and have the knowledge and capability to help us make the game better.
The engine (albiet, a very old version) is available from sourceForge, and has a lot of high-end code that you can learn a lot from. You'd need an extremely high level of knowledge to do anything with it though - it is essentially a bare-bones engine.
_________________
|
Ignorance Grand Admiral
Joined: October 27, 2012 Posts: 85
| Posted: 2013-02-25 20:47  
So what is the localserver thingy?
_________________ Lt. Commander Data: \"In the game of poker, there is a moment when a player must decide if an opponent is being deceptive, or actually holds a winning hand.\"
|
Null Pointer Grand Admiral Templar Knights
Joined: April 10, 2010 Posts: 148
| Posted: 2013-02-25 21:39  
Quote:
|
On 2013-02-25 20:47, Ignorance[Helper] wrote:
So what is the localserver thingy?
|
|
I believe it is for the tutorial.
_________________
|
Doran Chief Marshal Galactic Navy
Joined: March 29, 2003 Posts: 4032 From: The Gideon Unit
| Posted: 2013-02-25 22:39  
it is.
_________________
|
Ignorance Grand Admiral
Joined: October 27, 2012 Posts: 85
| Posted: 2013-02-26 16:45  
Ah ok.
_________________ Lt. Commander Data: \"In the game of poker, there is a moment when a player must decide if an opponent is being deceptive, or actually holds a winning hand.\"
|