(In my opinion Visual Studio is the best option for writing c++ on windows)
Download Visual C++ express
[Basic "hello world" console program]
Code:
#include <iostream> // for input and output on console application
using namespace std; //using the Standard Template Library
int main() //program runs
{
std::cout << "Hello World!" << endl; //output Hello World on console
return 0; //program is over
}
[Simulate "Random dice Roll"]
Code:
//program similates a random dice roll
#include <iostream>
#include <ctime>
#include <string>
using namespace std;
int main()
{
srand(time(0)); //get random number
int roll = 0;
bool quit = false;
while (!quit) //run game until user quits
{
cout << "Type roll to get dice roll! or Q to quit" << endl;
string test = "";
getline(cin,test); //get user input and place in string
if(test == "roll")
{
roll = rand() % 6 + 1; //get random number from 1-6
cout << "Number: " << roll << endl;
}
else if(test == "Q")
quit = true;
else
{
cout << "Error input not valid: Enter either roll or Q" << endl;
}
}
return 0;
}
I was thinking about making some c++ tutorials on classes,inheritance,pointers,polymorphism,function s,templates,namespaces...............etc
but just wondering on how many people would actually use them?