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;
}
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...
If your initial bet was $5, your second bet must be $10, then $15, etc. If...
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...
#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 =...
working on a program in c++ The user enters an email address into your program. You must cuteverything after the @ symbol and output it. #include <iostream> #include <string> using namespace std; int main() { string email_adress = ""; //email get the info cout <<"what is your email adress? "; getline(cin, email_adress) ; cin.ignore('@'); // now we put into writitng in sentence cout <<"the email you entered is: " << email_adress << ". " <<"your email adress domian is :"...
#include <iostream> #include <string> using namespace std; int main() { int number; int sum = 0; while(true) { cout << "Please enter a number between 1 and 11: "; cin >> number; if (number >= 1 && number <= 11) { cout << number << endl; sum = sum + number; //only add the sum when number is in range: 1-11, so add wthin this if case } else { cout << number << endl; cout << "Out of range;...
Write following program using Switch statement. #include <iostream> using namespace std; int main() int number; cout << "Enter an integer cin >> number; if (number > B) cout << You entered a positive integer: " << number << endl; else if (number (8) cout<<"You entered a negative integer: " << number << endl; cout << "You entered e." << endl; cout << "This line is always printed." return 0;
Consider the following program in which the statements are in the incorrect order. Rearrange the statements so that the program prompts the user to input the height and the radius of the base of a cylinder and outputs the volume and surface area of the cylinder. Formant the output to two decimal places. #include <iomanip> #include <cmath> int main () {} double height; cout << ”Volume of the cylinder = “ <<PI * pow(radius, 2.0) * height << endl; cout...
I am having trouble figuring out what should go in the place of "number" to make the loop stop as soon as they enter the value they put in for the "count" input. I am also having trouble nesting a do while loop into the original while loop (if that is even what I am supposed to do to get the program to keep going if the user wants to enter more numbers???) I have inserted the question below, as...
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...
61. The following program is accepted by the compiler: int sum( int x, int y ) { int result; result = x + y; } T__ F__ 62. The following implementation is accepted by the compiler: void product() { int a; int b; int c; int result; cout << "Enter three integers: "; cin >> a >> b >> c; result = a * b * c; ...