Dear everyone!
i doing little study on C++ an got stuck in this assignment and hoping for everyone to contribute and help.
GOAL In this program you will first create a string that has the
exact content "Hello Apple." The command line should have
either no parameters ( print id line as in the code below)
or just one parameter which is an integer.
The following text lists errors you must detect and a
priority of testing. All outputs are a single character
followed by a linefeed ( endl in C++ or \n in C).
If there is more than one parameter the output
shall be 'P'.
If the parameter is not an integer the output
shall 'X'.
The input integer is an index into the string where [0]='H',
[1]='e' etc. Your program should return the letter
pointed to by the number then a linefeed. If the number
is not within the string the reply must be Z.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <iostream>
#include <cstdlib>
#include <time.h>
#include <sys/time.h>
using namespace std;
int main(int argc, char *argv[])
{//--- When no parameters MUST print id string in CSV format.
if (argc == 1) // no parameters.
{ cout << "Hello Everyone"
<< endl ;
return(0) ;
}
//--- START THE CODE FROM HERE.
{
cout << " and the answer is ..." << endl ;
return(0) ;
}
Hope everyone can help!
Thank in advance
i doing little study on C++ an got stuck in this assignment and hoping for everyone to contribute and help.
GOAL In this program you will first create a string that has the
exact content "Hello Apple." The command line should have
either no parameters ( print id line as in the code below)
or just one parameter which is an integer.
The following text lists errors you must detect and a
priority of testing. All outputs are a single character
followed by a linefeed ( endl in C++ or \n in C).
If there is more than one parameter the output
shall be 'P'.
If the parameter is not an integer the output
shall 'X'.
The input integer is an index into the string where [0]='H',
[1]='e' etc. Your program should return the letter
pointed to by the number then a linefeed. If the number
is not within the string the reply must be Z.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <iostream>
#include <cstdlib>
#include <time.h>
#include <sys/time.h>
using namespace std;
int main(int argc, char *argv[])
{//--- When no parameters MUST print id string in CSV format.
if (argc == 1) // no parameters.
{ cout << "Hello Everyone"
<< endl ;
return(0) ;
}
//--- START THE CODE FROM HERE.
{
cout << " and the answer is ..." << endl ;
return(0) ;
}
Hope everyone can help!
Thank in advance