subject

// Write a program to prompt a user for 3 values and store the values in 3 different strings. // The first string should store the first and last name, second string a number to be added, the 3rd string another number to be added.
// Multiply the 1st number by the 2nd number and display the results.
// Run 1: "John Doe", "60", "5".
// Run 2: "Mary-Jane Anon", "1212.65", "345.88"
#include using namespace std; int Compute(int val1, int val2, int val3) { int numbers[3]; numbers[0] = val1; numbers[1] = val2; numbers[2] = val3; int result = 0; int i; for (i = 0; i < 3; ++i) { result += numbers[i] - 2; } return result; } int main() { int value1 = 3; int value2 = 4; int value3 = 2; int computedValue; computedValue = Compute(value1, value2, value3); cout << computedValue << endl; return 0; }
//This is my code. I can't quite get it right. I'm trying to implement c-string, but I don't think Im doing/using it correctly. And after entering the second value, it just goes straight to the multiplication part and skips the prompt for the third value. Also, I don't quite understand what it meant "The first string should store the first and last name, second string a number to be added, the 3rd string another number to be added."

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 19:30
Once the data center routes to the destination server that hosts the website, what's the next step in the internet process? user’s browser renders html code from destination server into web page request goes through router/model and isp request routed to nameserver and datacenter
Answers: 2
question
Computers and Technology, 23.06.2019 05:00
In cell b18, enter a formula to calculate the amount budgeted for meals. this amount is based on the daily meal allowance and the total travel days (# of nights+1).
Answers: 1
question
Computers and Technology, 23.06.2019 06:00
Respond to the following in three to five sentences. select the workplace skill, habit, or attitude described in this chapter that you believe is most important for being a successful employee.
Answers: 1
question
Computers and Technology, 23.06.2019 08:30
When you interpret the behavior of others according to your experiences and understanding of the world your evaluation is
Answers: 1
You know the right answer?
// Write a program to prompt a user for 3 values and store the values in 3 different strings. // Th...
Questions
question
Mathematics, 24.04.2021 01:00
question
Mathematics, 24.04.2021 01:00
question
Mathematics, 24.04.2021 01:00
question
Mathematics, 24.04.2021 01:00
question
Chemistry, 24.04.2021 01:00
Questions on the website: 13722360