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]
3 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]3 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
Write a Python program string_functions.py that defines several functions. Each function re-implements Python's built-in string
Svetach [21]

Answer:

def length( mystring):

   count = 0

   for i in mystring:

       count += 1

   return count

def reversed( mystring):

   strlist = []

   for i in range(length(mystring)):

       strlist.append(mystring[(length(mystring) - 1) - i])

       txt = "".join(strlist)

   return txt

string = 'Yolanda'

print(reversed(string))

Explanation:

The python module defines two functions 'reversed' and 'length'. The length function counts the number of characters in a string variable while the reversed function reverses the string variable value.

3 0
2 years ago
Choose 2 statements that correctly describe the time complexity of data structures with N data.
Softa [21]

The  statements that correctly describe the time complexity of data structures with N data are:

  • The average time complexity of the data lookup in a hash table is O(N).
  • The average time complexity of inserting data into a heap is O(logN)

<h3>What is time complexity of data structures?</h3>

Time Complexity of an algorithm is known to be the depiction of the amount of time needed by the algorithm to carry out to completion.

Note that The  statements that correctly describe the time complexity of data structures with N data are:

  • The average time complexity of the data lookup in a hash table is O(N).
  • The average time complexity of inserting data into a heap is O(logN)

Learn more about data from

brainly.com/question/17350816

#SPJ1

6 0
1 year ago
When saving a memo you created in Word, which one of the following extensions is automatically assigned to the document?
VMariaS [17]
What are the options and if it's meaning like when you save something it has .pdf .jpg or .doc after the title then it would be ".doc"
8 0
2 years ago
Write an if/else statement that compares the value of the variables soldYesterday and soldToday, and based upon that comparison
jenyasd209 [6]

Answer:

if(soldYesterday > soldToday){

salesTrend = -1;

} else if(soldToday > soldYesterday){

salesTrend = 1;

}

Explanation:

The if/else statement is more explicit. The first if condition check if soldYesterday is greater than soldToday, if true, then -1 is assigned to salesTrend.

Else if soldToday is greater than soldYesterday, if true, then 1 is assigned to salesTrend.

7 0
3 years ago
Could Anyone Please Explain To Me What Is Supervised Learning In Machine Learning? I encourage that you explain it in simple wor
nadya68 [22]

Answer:

Kindly check Explanation.

Explanation:

Machine Learning refers to a concept of teaching or empowering systems with the ability to learn without explicit programming.

Supervised machine learning refers to a Machine learning concept whereby the system is provided with both features and label or target data to learn from. The target or label refers to the actual prediction which is provided alongside the learning features. This means that the output, target or label of the features used in training is provided to the system. this is where the word supervised comes in, the target or label provided during training or teaching the system ensures that the system can evaluate the correctness of what is she's being taught. The actual prediction provided ensures that the predictions made by the system can be monitored and accuracy evaluated.

Hence the main difference between supervised and unsupervised machine learning is the fact that one is provided with label or target data( supervised learning) and unsupervised learning isn't provided with target data, hence, it finds pattern in the data on it's own.

A to B mapping or input to output refers to the feature to target mapping.

Where A or input represents the feature parameters and B or output means the target or label parameter.

4 0
3 years ago
Other questions:
  • What does cro stand for?
    7·2 answers
  • When you send an echo request message with the ping program, a successful attempt will return a(n) ______ message.
    8·1 answer
  • Explain how the principles underlying agile methods lead to accelerated development and deployment of software.
    6·1 answer
  • An air-conditioning system's automatic controller might directly control the
    7·2 answers
  • What command prompts should be used to assign an IP address to:
    9·1 answer
  • The expression that is tested by a switch statement must have a(n) __________ value.
    12·1 answer
  • What is drop shipping and how it works on amazon?
    12·1 answer
  • Communication media that use an antenna for transmitting data through air or water are called _____.
    14·1 answer
  • In _____, a program running on a Web server creates a Web page in response to a request for specific information from a Web clie
    7·1 answer
  • Product of -6/13 and reciprocal of -7/16 is ____________​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!