Question

If your initial bet was $5, your second bet must be $10, then $15, etc. If...

If your initial bet was $5, your second bet must be $10, then $15, etc. If your initial bet was $2, your second bet must be $4, then $6, etc.

Write a program that outputs the sum of the first "numBets" multiples of a number "initialBet", where "numBets" and "initialBet" are integers taken in as user input.

#include <iostream>
using namespace std;

int main()
{
   cout << "Enter the initial bet, followed by "
        << "the number of bets you want to make" << endl;
   int initialBet, numBets;
   cin >> initialBet >> numBets;



   cout <<       << endl;

   return 0;
}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

C++ CODE:

#include <iostream>

using namespace std;

int main()

{

cout << "Enter the initial bet, followed by "

<< "the number of bets you want to make" << endl;

int initialBet =0, numBets;

cin >> initialBet >> numBets;

cout << "Your Initial Bet is = "<<"$"<< initialBet<<endl;

for(int i=2; i<=numBets; i++){

int value= initialBet * i;

cout << "Your "<< i <<" Bet is: "<<"$"<<value<< endl;

}

return 0;

}

Output:

Enter the initial bet, followed by the number of bets you want to make

5

3

Your Initial Bet is = $5

Your 2 Bet is: $10

Your 3 Bet is:$15

Output Snapshots:

Please give Thumbs Up...

Add a comment
Know the answer?
Add Answer to:
If your initial bet was $5, your second bet must be $10, then $15, etc. If...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Create a program with the main function and one additional function. The additional function asks for...

    Create a program with the main function and one additional function. The additional function asks for input from the user and returns the output back to the main function for display. This is for c++ and here is my code, could you guys please tell me what I am missing from the instructions. Thank you #include <iostream> using namespace std; int sum (int, int); int main() {     int n1, n2, total;               cout << "Enter two numbers...

  • I am having trouble figuring out why my program will not make any columns, just rows....

    I am having trouble figuring out why my program will not make any columns, just rows. I need to display a square. The instructions are provided below. (This for my C++ class) Write a program that displays a square. Ask the user for the square’s size. Only accept positive integer numbers (meaning choose a data type that holds positive integer values). The size the user gives you will determine the length and width of the square. The program should then...

  • 15.6: Fix the code to print the count from 1 to x (to loop x times)...

    15.6: Fix the code to print the count from 1 to x (to loop x times) #include <iostream> // include the header file using namespace std; void count(int x){    for(int i=1; i<=x; i++){ cout<<x; } } int main(){    int x,i;    cin >> x; count(x);    return 0; } 15.7 Fix the nested for loops to print the count from 1 to x twice, e.g. "12....x12.....x" #include <iostream> // include the header file using namespace std; int main(){...

  • #include <iostream> using namespace std; int main() {    int sumOdd = 0; // For accumulating...

    #include <iostream> using namespace std; int main() {    int sumOdd = 0; // For accumulating odd numbers, init to 0    int sumEven = 0; // For accumulating even numbers, init to 0    int upperbound; // Sum from 1 to this upperbound    // Prompt user for an upperbound    cout << "Enter the upperbound: ";    cin >> upperbound;    // Use a loop to repeatedly add 1, 2, 3,..., up to upperbound    int number =...

  • 4) What is the output if the input istom - Sawyer? #include <iostream> using namespace std;...

    4) What is the output if the input istom - Sawyer? #include <iostream> using namespace std; int main() { string playerName; cout << "Enter name"; cin >> playerName; cout << endl « playerName; return 0; } a. Tom - Sawyer b. Tom Sawyer c. Tom d. Sawyer 5) Which XXX generates "Adam is 30 years old." as the output? #include <iostream> using namespace std; int main() { string name = "Adam"; int age = 30; XXX return 0; } a....

  • B) draw the runtime stack fall the steps (a) write the output of the following program....

    B) draw the runtime stack fall the steps (a) write the output of the following program. The output must include everything that a computer may produce on its screen, including the prompts, input, output, and their positions. Suppose the input integers are 1 and 2, in this order. (b) Draw the run time stack for every step of execution on the next page. You need to mark the return address(es) yourself. #include <iostream> using namespace std; int a; int b;...

  • Please Help! Write a C++ program to read integers until 9999 is entered (called sentinel –...

    Please Help! Write a C++ program to read integers until 9999 is entered (called sentinel – sentinel is used to indicate the end of input and must not to be considered as the valid data for the computation). Perform the following operations for the integers entered by the user. Display the sum of the numbers less than 100 Display the smallest of the positive integers Display the largest of the negative integers Display how many integers are between 100 and...

  • #include<iostream> using namespace std; int main() { float num,avg,sum=0.0; int count=0; bool moreNumbers=true; cout<<"Enter grades:"<<endl; while(moreNumbers)...

    #include<iostream> using namespace std; int main() { float num,avg,sum=0.0; int count=0; bool moreNumbers=true; cout<<"Enter grades:"<<endl; while(moreNumbers) { cin>>num; if(num < 0) { moreNumbers=false; } else { count = count+1; sum=sum+num; } } avg=sum/count; cout<<"Average grade:"<<avg<<endl; cout<<"How many grades were entered:"<<count<<endl; return 0; } Question: We need to add another loop to check input. Just like the input loop we already have, this one should use a boolean variable as a control. So, the logic could be something like this: Loop...

  • When I input 210 or 110 or 340 it always returns 0 instead of 3 or...

    When I input 210 or 110 or 340 it always returns 0 instead of 3 or 2 or 7. Why isn't it adding the sum of all the numbers? #include <iostream> using namespace std; int main() {     long num;     cout << "Input a number: ";     cin >> num;       int n = 0;    while (num != 0) {       n += num % 10;       num = num / 10;    }    if (num...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT