Version info in cout.

Hello, I'm new to C++ I started it like a week ago in this class I'm taking.

So i'm making some little fun adventure thing and at the beginning I want to display the version of the game. I was wondering if there was a way to implement the version info from the project properties into a cout message thing.

Thanks!
Are you just using console application(no images and stuff)?
yeah, that's all we're doing in the class so far. i think later on the school year we'll be doing stuff with images
So is there a way to do this..?
Have a header file in your project containing integers constants to hold your major/minor version number. then have a method to build up a string of this eg:

1
2
3
4
5
std::string GetVersionNumber()
{

....// build up the version string e.g. "12.4.2"
}


then call this when you want to print it.
What platform?

Windows (.NET) has the Version class.
http://msdn.microsoft.com/en-us/library/system.version(v=vs.110).aspx?cs-save-lang=1&cs-lang=cpp#code-snippet-1

It would be a whole lot simpler to include a version variable in your source code and update it when you change your program.

1
2
3
4
 
  const string program_version = "1.0";

  cout << "My game version: " << program_version << endl;


Last edited on
Topic archived. No new replies allowed.