[Solved] C++ program does nothing when executed

Vectors in c++ are dynamically sized. You can create a vector without a size argument in the constructor then push size number of elements like so: vector<int> makeGaps (int size){ vector<int> vectorOfGaps; for(int i = 0; i < size;i++){ vectorOfGaps.push_back(i); } return vectorOfGaps; } Edit: Also, as someone already pointed out in your comments, it … Read more

[Solved] Can’t use void() [closed]

Try :- if (stringInput == “attack ennemy”) { cout << endl << “You dealt 100 attack points to: ENNEMY” << endl; ennemyHealthPoints = ennemyHealthPoints – attackPoints; **displayEnnemyStatus(ennemyAttackPoints, ennemyHealthPoints)**; } Instead of :- if (stringInput = attack ennemy) { cout << endl << “You dealt 100 attack points to: ENNEMY” << endl; ennemyHealthPoints = ennemyHealthPoints – … Read more

[Solved] C++ does not name a type error in Codeblocks [duplicate]

You can’t put arbitrary statements at the file scope in C++, you need to put them in a function. #include <string> #include <fstream> #include <streambuf> #include <sstream> int main () { //These are now local variables std::ifstream t(“C:/Windows/System32/drivers/etc/hosts-backup.txt”); std::stringstream buffer; //We can write expression statements because we’re in a function buffer << t.rdbuf(); } 4 … Read more