Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- struct Person
- {
- char name[20];
- int age;
- };
- Person new_person(char *argv);
- int main(int argc, char *argv[])
- {
- if (argc < 3) // if its not 3 inputs including the command , result in error
- {
- cout << "You didn't give enough input information for this to run." << endl;
- return 0;
- }
- else if (argc > 3) // if its not 3 inputs including the command resuls in error
- {
- cout << "You put too many inputs for this program to run." << endl;
- return 0;
- }
- Person input_Person;
- input_Person = new_person(*argv);
- cout << "The person's name is " << input_Person.name << " and that person is " << input_Person.age << " years old." << endl;
- return 0;
- }
- Person new_person(char *argv)
- {
- Person person;
- strcpy (argv[1],person.name);
- person.age = argv[2];
- return person;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement