Since I'm working on a generator and I don't want to have to put the same lines at every category, since that takes to much time and I haven't got that many time.
How do I make a block of code useable in 1 or 2 lines? Eg. below.
#include <iostream>
void someFunction(void); //no parameters, this is the prototype
int main()
{
someFunction(); //calling the function with no variables or values as parameters
return 0;
}
void someFunction(void) //declaring the function, again no parameters
{
std::cout << "Hello, world!" << std::endl;
}
Just put the stuff you want to be repeated in functions like I mentioned before then call that function when ever you want that stuff to appear. If you want to add extra things to output as well give the function a parameter. PS a name should be a string of characters not an int :P. You could also (though probably not the best) is assign the repeated messages to a string like
1 2 3 4
std::string const message = "Some message to be repeated.";
//then do something like
[code]std::cout << message << " other stuff" << std::endl;