Write a program that runs from the command line and takes a

Write a program that runs from the command line and takes a number and a name as an input from the user. It then says hello to it as many times as the user specified number. For example, the command line should show something like this: Show whole program in C++ Stange_things_happen.exe 4 student Hello student, Hello student, Hello student, Hello student,

Solution

#include <iostream>
#include <string>
using namespace std;
int main(int argc,char* argv[])
{
    for(int i=0;i<stoi(argv[1]);i++)
    {
        cout<<argv[2]<<endl;
    }
    return 0;
}

 Write a program that runs from the command line and takes a number and a name as an input from the user. It then says hello to it as many times as the user spe

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site