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
s2008m [1.1K]
3 years ago
10

Write a fragment of code that reads in strings from standard input, until end-of-file and prints to standard output the largest

value. You may assume there is at least one value. (cascading/streaming logic, basic string processing)
Computers and Technology
1 answer:
Nady [450]3 years ago
8 0

Answer:

Explanation:

Sample input file: numbers.txt

8 9 7 67 78 45 67 99 1001

Sample Output:

The largest value is:1001

Code to Copy:

// include stdafx, if using visual studio.

#include "stdafx.h"

// declare the necessary header files.

#include <iostream>

#include <string>

#include <fstream>

using namespace std;

// Start the main function

int main()

{

// create the object of ifstream.

ifstream in_file;

// Open the file

in_file.open("numbers.txt");

// Declare the string variable

string str;

// Declare the integer variables.

int maximum = 0;

int num;

// Check whether the file open

if (in_file.is_open())

{

// Traverse the file till the end.

while (!in_file.eof())

{

// traversing the value.

in_file >> str;

// convert the string into integer.

num = stoi(str);

// Check whether value is max or not.

if (maximum < num)

{

// Update the value of maximum.

maximum = num;

}

}

}

// Display the statement on console.

cout << "The largest value is:" << maximum << endl;

// Close the file.

in_file.close();

system("pause");

return 0;

}

You might be interested in
6. The NADH and FADH2 produced during the Krebs cycle pass their electrons down the 7. __ __ __ __ __ __ __ __ __ __ __ __ __ __
AlladinOne [14]

Answer:

The NADH and FADH2 produced during the Krebs cycle pass the electrons down  electron transport chain in the mitochondria to generate more ATP molecules

Explanation:

FADH2 stands for Flavin adenine dinucleotide and NADH stands for Nicotinamide adenine dinucleotide.

Both are created from FAD and NAD+ through reduction-oxidation reactions in the Krebs cycle during respiration as explained below:

This cycle gives off small amounts of energy in the form of adenosine triphosphate, or ATP, and produces these compounds, FADH2 and NADH. The Krebs cycle is like a wheel. Every time it makes one full rotation, energy is created and released. As you can see from the diagram, the NAD+ and FAD are brought in at key points throughout the cycle and are attached to other electrons resulting in the formation of NADH and FADH2.

This energy is then shuttled off to be used by the cell, mostly for the continuation of cellular respiration.

As they are shuttled away, these two compounds are used to move electrons into the electron transport chain, the final stage of respiration. It is in this stage that most of the energy is created and released from the mitochondria (powerhouse of the cell).

Basically the NADH and FADH2 are affixed with electrons and tranfered to the inner membrane of the mitochondria. The travel down the electron transfer chain, releasing electrons they once had. Thereby releasing alot of energy in the process

3 0
3 years ago
Which marketing strategy is represented by advertisers paying for online display ads?
e-lub [12.9K]

Answer:

The answer is (c) paid media

Explanation:

Because they are paying for the ad to be displayed online. hope this helps!

8 0
3 years ago
Purpose: This application provides experience with user input and interaction in the Console, writing files to disk, working wit
pishuonlain [190]

Answer:

the answer is c#/.net

Explanation:

5 0
3 years ago
What is one of the main problems with shared web hosting? Select one: Sites that share resources are less susceptible to hacking
Pani-rosa [81]

Answer:

If one or more of the shared sites go down, then there is a good chance that your site will go down as well.

Explanation:

Shared web hosting is a form of web hosting service whereby more than one websites are placed on a single web server that connects to the internet.

Though it is cheaper, it has various problems. And over time, it has been concluded that the major problem associated with shared web hosting is the security issue.

This implies that "If one or more of the shared sites go down, then there is a good chance that your site will go down as well."

Some other problems associated with Shared web hosting are poor value, less flexibility, none advanced features, slow service, less support.

4 0
3 years ago
What are some differences between CUI and GUI ?
ollegr [7]

Answer:

Even though both are interfaces and serve its purpose of attempting to run the strategies, their components as well as the manipulate they will get from the patient differ.

Explanation:

CUI (Character User Interface) :-

  • It's a sort of user interface that only uses binary data and pseudographics for interface-output and data sessions.
  • That's characterized by low availability for operating systems I / O resources (act with integrity) and high speed with a display of data.

GUI (Graphical User Interface (GUI):-

  • Using graphical elements such as windows, icons, menus helps the user to communicate with the program.
  • It is a kind of user interface along which people interact with electronic equipment through characterizations of visual indicators.
3 0
3 years ago
Other questions:
  • Dr. Patterson’s office calls to give patient Sara Martin her test results from her most recent visit. Her husband answers the ph
    8·2 answers
  • What are some good job skills?
    12·1 answer
  • WHAT IS A COMPUTER ????
    14·2 answers
  • What is transaction model?
    9·2 answers
  • ________ is a remote access client/server protocol that provides authentication and authorization capabilities to users who are
    10·1 answer
  • What is are motor vehicle emissions?
    8·1 answer
  • Part 2: a) Write VHDL code for a top module that invokes necessary components to display the four decimal digits on four seven-s
    5·1 answer
  • What is a function of Agile software development?<br>​
    7·1 answer
  • You received an email message stating that your mother's bank account is going to be forfeited if you do not respond to the emai
    6·1 answer
  • Could you tell me the family link app code to unlock a phone please?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!