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
Within an event-driven program a component from which an event is generated is the ____
mojhsa [17]
The answer is: <span>Source of the Event</span>
7 0
3 years ago
In order for an IT security framework to meet information assurance needs, the framework needs to include policies for several a
Ugo [173]

Answer:

(1) Protecting the privacy of personal data and proprietary information

(2) Proprietary Information

These two cannot be infringed on but below are the policies that must be taken in high esteem and can be infringed upon

(1) Disaster Recovery Policy

(2) Acceptable Use Policy

(3) Business Continuity plan

4 0
3 years ago
WHAT DOES THE TRANSPORT LAYER USE TO MAKE SURE THAT A MESSAGE IS REASSWMBLED CORRECTLY ON THE RECEIVING DEVICES?
mrs_skeptik [129]
The answer is  sequence  number
6 0
3 years ago
Public class Bird
Anna007 [38]

Answer:

Answer below.

Explanation:

You are creating an object of bird "b" with a talon strength of 5 and a beak of 5.

public Hawk(int talon, int beak)

{

super(beak);

talonStrength = talon;

}

Please mark brainliest if this is the answer you were looking for

Please mark brainliest if this is the answer you were looking for

6 0
3 years ago
blank protects equipment from too much current by tripping a switch that breaks the circuit, stopping the flow of electricity
e-lub [12.9K]

FUSE! (BRAINLIEST PLEASE)


4 0
3 years ago
Other questions:
  • Categories of functions specified by computer instruction?
    11·1 answer
  • A misfire code is a type _______ diagnostic trouble code (DTC).
    5·1 answer
  • Do you need to know javascript to learn python?
    8·1 answer
  • Kiera is building a new computer and wants to make sure she has an adequate power supply for all the new equipment she is purcha
    15·2 answers
  • Study the images of two different fronts.
    7·2 answers
  • A technician wants to limit access to a group of folders and is using Group Policy to prevent the users in the sales department
    9·1 answer
  • Which statement describes Augmented Reality (AR) technology?
    12·1 answer
  • 2. What is the name for an action performed by the VR Robot?
    7·2 answers
  • Does anyone know this? Can someone please help me? I’ll give brainliest!!
    7·1 answer
  • What would be a social networking page background for Sigmund Freud?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!