What do you want to save?
Add Code snippet
New code examples
-
C++ 2021-09-13 19:06:03
seed random c++
#include<iostream> #include<cstdlib> using namespace std; int main() { int random = rand(); /* No srand() calls before rand(), so seed = 1*/ cout << "Seed = 1, Random number = " << random << endl; srand(5); /... Add solution -
C++ 2021-09-13 11:04:03
how to input a file path in c++
int main() { std::cout << "Please enter the file name: "; std::string name; std::getline (std::cin, name); ifstream ifs(name.c_str()); if (!ifs) error("can't open input file ", name); vector < Point &g... Add solution -
C++ 2021-09-13 06:00:03
lopping over an array c++
for (int i = 0; i < arr.size(); ++i){ //use if we explicitly need the value of i cout << i << ":\t" << arr[i] << endl; } for (int element : arr){ //modifying element will not affect the array cout << element <... Add solution