1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
svetoff [14.1K]
4 years ago
6

AddAll - Adds all the doubles in the string with each other. Note every double is separated by a semi-colon. AddAll("1.245;2.9")

=>4.145 double AddAll(const char* str) struct Sale char Person[100]; double sale; double tax; struct SaleStatistic double average Sale; double totalSale; double totalTax; (4) AddAl - Adds all the doubles in the string with semi-colon. AddAll("1.245;2.9")=>4.145 double AddAll(const char* str) { ww struct Sale { char Person[100]; double sale; double tax; }; struct SaleStatistic -- double average Sale: double totalSale: double totalTax:
Computers and Technology
1 answer:
ludmilkaskok [199]4 years ago
3 0

Answer: provided below

Explanation:

The code is provided below/

// the method to add all double value in the string

double AddAll(const char *str)

{

double total = 0;

vector<string> vec;

 

stringstream strStream(str);

 

while (strStream.good())

{

string substr;

getline(strStream, substr, ';');

vec.push_back(substr);

}

 

for (size_t i = 0; i < vec.size(); i++)

{

total = total + stod(vec[i]);

}

return total;

}

 

Program code with addition of the above for testing is provided thus

#include <iostream>

#include <sstream>

#include <vector>

using namespace std;

//addin all double value in syring

double AddAll(const char *str)

{

double total = 0;

vector<string> vec;

 

stringstream strStream(str);

 

while (strStream.good())

{

string substr;

getline(strStream, substr, ';');

vec.push_back(substr);

}

 

for (size_t i = 0; i < vec.size(); i++)

{

total = total + stod(vec[i]);

}

return total;

}

int main()

{

//method calling and display result

cout<<AddAll("1.245;2.9");

}

This gives output as:

4.145

You might be interested in
What can you do with youtube red that you cant do with a normal account?
ipn [44]
No, Ad's. Extra Videos Created By Youtube, and thats about it lol oh and you can play the audio in the background of your phone, like lets say your listening to some music on youtube, and you want to play a game on your phone while listening to that tune on youtube, i just said screw youtube, i jailbroke my device and i have 20X more control of my youtube setting, etc.. and plus i can do more without youtube red tbh lol.
7 0
3 years ago
Read 2 more answers
PLEASE I NEED HELP FAST
tankabanditka [31]

Answer:

your answer will be src=

7 0
3 years ago
An independent penetration testing company is invited to test a company's legacy banking application developed for Android phone
erastovalidia [21]

2010s is the one who created the iPhone

8 0
3 years ago
ITS: Explain briefly<br>Character​
amid [387]

Answer:

what is briefly tell me also

7 0
3 years ago
what could backupdocs.com documents backup pdf program handle at one point if at all backupdocs.com functions documents saving p
bekas [8.4K]
This don’t make sense?? But I think it can handle it aha
6 0
3 years ago
Other questions:
  • Assume you have the following array: int[] values = new int[15]; What will happen if the following code is executed? int[15] = 2
    12·1 answer
  • “When using a public computer for browsing the Internet, try to use for 1.________ transactions. Also, use 2.__________ browsing
    10·2 answers
  • 1. __________ indicate a BAL of .10% or higher.
    10·1 answer
  • To save a file so that it can be opened on most computers, select the ____ option.
    10·2 answers
  • Data owners ensure that only the access that is needed to perform day-to-day operations is granted and that duties are separated
    10·1 answer
  • PLZ HELP FAST!!!! 
    7·2 answers
  • Remember to check the on your vehicle first to see if a repair is covered by the manufacturer.
    15·1 answer
  • George enters the types of gases and the amount of gases emitted in two columns of an Excel sheet. Based on this data he creates
    6·1 answer
  • Class C Airspace inner ring begins at the __________ and extends vertically (by definition) to MSL charted values that generally
    5·1 answer
  • Can people survive without technology?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!