Does anyone know why this code:
Quote:#include <iostream>
#include <stdio.h>
int main()
{
cout << "IT WORKS!\n";
cout << "\nPress Enter to continue" << endl;
getchar();
return 0;
}
doesn't work? i get an error in the
cout << "IT WORKS!\n";
cout << "\nPress Enter to continue" << endl;
use std::cout instead of just cout
Also, next time you get an error, be sure to post the actual error message
thank you

its weard because the book says "cout" not "std::cout" :O
maybe somewhere they have a
Code:
using namespace std;
In older C++, cout used to be global, you could use it without the std prefix. But that was years ago, and only in some compilers.
thanks,
i'm now trying to make a configuration file just like with my build script but than in c++ just to practise.
i'm now struggeling that i can't put letters in a variable. with the server description part if i now put letters in it, it says 0 in the settings.ini.
if you want to look in the "source" this is it:
Code:
#include <iostream>
#include <fstream>
using namespace std;
//the remove part
int Remove()
{
if( remove( "Settings.ini" ) != 0 )
perror( "Error deleting file" );
else
puts( "File successfully deleted" );
return 0;
}
//the server configuration
int main()
{
int Port;
int MaxPlayers;
int Description;
cout << "Please Enter your server port (default minecraft is 25565): ";
cin >> Port;
cout << "Please enter the maxplayers able to join: ";
cin >> MaxPlayers;
cout << "Please enter your server description: ";
cin >> Description;
ofstream myfile;
myfile.open ("settings.ini");
myfile << "[Server]\n" << "port=" << Port << "\nmaxplayers=" << MaxPlayers << "\nDescription=" << Description;
myfile.close();
return 0;
}
it works but i can only have one word. if i type in: New Description
it only shows New

I suppose that cin operator >> extract only until any whitespace. The solution would be to repeat reading from cin until you get a '\n', and concatenate everything you've read into a string.
I never particularly liked streams, so I've never actually learnt much about them.
Seems there's a std::getline() just for this purpose:
http://www.cplusplus.com/reference/string/getline/
yay thanks it works

i can now get things like this:
Quote:[Server]
port=25565
maxplayers=20
Description=Description here please 
[Worlds]
DefaultWorld=Wpr;d
[Plugins]
Plugin=Core
Plugin=ChatLog
[HelpPlugin]
ShowPluginNames=1