//============================================================================ // Name : HelloWorldCPP.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include #include #include #include #include using namespace std; //Execute nextLine to skip to the next line of input in cin #define nextLine cin.ignore( 1000000, '\n' ) //These two lines of code will make the program read input from //the file"input.txt" located in the project folder. //IMPORTANT: Before submission, comment these two lines of code. ifstream fin("input.txt"); #define cin fin //Read a line containing a sequence of integers and //append the integers to v void readVector(vector &v) { string strLine; int x; getline(cin, strLine); istringstream sbuffer(strLine); while(sbuffer >> x) v.push_back(x); } //Read n integers and append the integers to v void readVector(vector &v, int n) { int x; for(int i=0; i> x; v.push_back(x); } } //Print out the integers in v void writeVector(vector &v) { for(unsigned int i=0; i < v.size(); i++) { cout << v[i]; if(i!=v.size()-1) cout << " "; } } int main() { int x; vector v; cin >> x; nextLine; v.clear(); readVector(v); writeVector(v); cout << endl; cout << "Max int = " << INT_MAX << endl; cout << "Max long = " << LONG_MAX << endl; cout << "Max long long = " << LLONG_MAX << endl; return 0; }