Write a program that will count from 1 to 10 by 1. The default output should be 1, 2, 3, 4, 5, 6 , 7, 8, 9, 10 There should be only a newline after the last number. Each number except the last should be followed by a comma and a space. To make your program more functional, you should parse command line arguments and change behavior based on their values. Argument Parameter Action -f, --first yes, an integer Change place you start counting -l, --last yes, an integer Change place you end counting -s, --skip optional, an integer, 1 if not specified Change the amount you add to the counter each iteration -h, --help none Print a help message including these instructions. -j, --joke none Tell a number based joke. So, if your program is called counter counter -f 10 --last 4 --skip 2 should produce 10, 8, 6, 4 Please use the last supplied argument. If your code is called counter, counter -f 4 -f 5 -f 6 should count from 6. You should count from first to last inclusively. You you may not display the last number if the skip value is something other than 1. The skip value should always be greater than 0.
Write a program that will count from 1 to 10 by 1. The default output should be
1, 2, 3, 4, 5, 6 , 7, 8, 9, 10
There should be only a newline after the last number. Each number except the last should be followed by a comma and a space.
To make your program more functional, you should parse command line arguments and change behavior based on their values.
Argument | Parameter | Action |
---|---|---|
-f, --first | yes, an integer | Change place you start counting |
-l, --last | yes, an integer | Change place you end counting |
-s, --skip | optional, an integer, 1 if not specified | Change the amount you add to the counter each iteration |
-h, --help | none | Print a help message including these instructions. |
-j, --joke | none | Tell a number based joke. |
So, if your program is called counter
counter -f 10 --last 4 --skip 2
should produce 10, 8, 6, 4
Please use the last supplied argument. If your code is called counter,
counter -f 4 -f 5 -f 6
should count from 6.
You should count from first to last inclusively.
You you may not display the last number if the skip value is something other than 1.
The skip value should always be greater than 0.
Unlock instant AI solutions
Tap the button
to generate a solution
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781305480537/9781305480537_smallCoverImage.jpg)
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)