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 02:30
If you turn on the lock alpha button , what happens
Answers: 1
question
Computers and Technology, 22.06.2019 18:30
All of the following are characteristics that must be contained in any knowledge representation scheme except
Answers: 3
question
Computers and Technology, 22.06.2019 18:30
Kto rozmawia z clamentain przez krótkofalówke w the walking dead która śledzi lee w 4 epizodzie
Answers: 1
question
Computers and Technology, 22.06.2019 20:00
What is the worst-case complexity of the maxrepeats function? assume that the longest string in the names array is at most 25 characters wide (i.e., string comparison can be treated as o( class namecounter { private: int* counts; int nc; string* names; int nn; public: namecounter (int ncounts, int nnames); int maxrepeats() const; }; int namecounter: : maxrepeats () { int maxcount = 0; for (int i = 0; i < nc; ++i) { int count = 1; for (int j = i+1; j < nc; ++j) { if (names[i] == names[j]) ++count; } maxcount = max(count, maxcount); } return maxcount; }
Answers: 3
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, 14.07.2019 20:00
Questions on the website: 13722363