uni year 2 student learning c++, and i have this code i created, within this code i use cin to ask for user input but my instructor want "You need to use argc and agrv[] in your main function. So users can inputs information into your program when they run it. For instance, "yourprogram.exe -P 50"." but i dont know how i could implement it. Thank the help
int main(int argc, char* argv[])
{
if (userchouise == "P" | userchouise == "A" )
{
if (userchouise == "P") // {
cin>>uservlue;
if (uservalue >= 100 | uservalue <= 0)
{
cout << "p " << endl;// Invalid duty cycle value
return 0;
}
else
{
cout<<uservalue<<endl;
}
return 0;
}
if (userchouise == "A") // can only input values from 0-7
{
int userPort;
cout << "enter port number between 0 to 7" << endl;
cin >> userPort;
if (userPort >= 0 | userPort <= 7)
{
}
else
{
cout << "a " << endl;//Invalid ADC channel number
}
return 0;
}
}
else
{
cout << "I " << endl;
}
return(0);
}