Generation

generate functionWed, 16 Nov 2022

Using command line parameters, the program loads two parameters: the name of the action (string t) and the number of lines in the input (number n). E.g.: $ ./AAPL 50 program If both of these parameters are not present at the program input, write the line with the message Wrong parameters and exit the program with code 1. n will always be a positive number (greater than zero). Next, the program reads n lines sequentially from the input. Each row will contain a record of the share value of a specific company on a specific day. There will be five comma-separated data on the line: Day index (integer) Share name (a string containing only uppercase letters of the English alphabet) Share value at the beginning of the day (decimal number) Share value at the end of the day (decimal number) Number of trades made on a given day (integer)

++ #include <iostream> #include <fstream> #include <string> #include <vector> using namespace std; int main() { string t; int n; cin >> t; cin >> n; if(t == "" || n == 0) { cout << "Wrong parameters"; return 1; } vector<string> v; for(int i = 0; i < n; i++) { string tmp; getline(cin, tmp); v.push_back(tmp); } ofstream file("output.txt"); if(file.is_open()) { file << "Hello world"; } file.close(); }

Want to kickstart your project?Use the new AI Studio to create your code