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
Adele’s mother owns a Daycare and she wants to learn all about this business, to help her mom and own it one day. Which CTSO sho
Gennadij [26K]

Answer:

She should join the Future Business Leaders of America–Phi Beta Lambda

Explanation:

CTSOs are Career and technical student organizations. These organizations are vocational and extracurricular groups based primarily in high schools, colleges and career technological centres, for students in Career and Technical Education. They are important parts of the high school and college programs.

The Future Business Leaders of America–Phi Beta Lambda prepares students to become community-minded business leaders. It provides opportunities to learn career skills and gain leadership experience.

Therefore Adele should pick this CTSO

7 0
3 years ago
g A sign of thrashing is Group of answer choices the CPU utilization increases as the degree of multiprogramming is increased. t
Bezzdna [24]

Answer:

the CPU utilization decreases as the degree of multiprogramming is increased.

Explanation:

The fundamental concept is that allocating a process with too few frames causes too many and frequent page faults. This implies that the CPU does not perform any useful work and thus its utilization would decrease drastically. In this case, the long-term scheduler, in a bid to improve the utilization of the CPU, would load more processes into the memory so as to increase the extent of multiprogramming. As a result, there would be more decrease in the utilization of the CPU, leading to a chained reaction of higher page faults, which is then followed by a corresponding increase in the multiprogramming degree, usually known as thrashing.

8 0
3 years ago
A state government is attempting to reduce the digital divide. Which of the following activities has the greatest potential to c
Sveta_85 [38]

Answer:

The correct answer is

Working with technology companies to offer computing devices at discounted prices to individuals with reduced incomes

Explanation:

As per the question, state government is trying to reduce the digital divide which primarily exists because low income people do not have access to the digital devices. Hence, any step taken to help the low income people to get the digital device will be the best strategy of government to reduce the digital divide.

Thus, the correct answer is Working with technology companies to offer computing devices at discounted prices to individuals with reduced incomes

7 0
3 years ago
What is a reason for users and businesses to adopt 5G networks?
anzhelika [568]

Answer:

I think users and businesses needs to adopt 5g networks for primary benefits include improved bandwidth, latency, reliability, connection density and security - all important factors in the increasing move to remote working and greater reliance on online services

Explanation:

sana po nakatulong

7 0
2 years ago
What are the two components that make up the chipset?
svet-max [94.6K]
Northbridge and Southbridge components.
6 0
3 years ago
Other questions:
  • true /falseCompression of entries in the term-document matrix can be used to reduce run-time storage and execution-time requirem
    10·1 answer
  • A disadvantage of a bus network is that _____. a. failure in one workstation necessarily affects other workstations on the netwo
    7·1 answer
  • A _____ is the useful part of a transmission through a network.
    15·1 answer
  • Why are answers not appearing? I've seen many complain about this recently.
    8·1 answer
  • How to simplify???? 2(-3x^2+6x+1)-2(4x^2-3x+1)<br><br>​
    7·1 answer
  • Which of the following is an example of a content management system (CMS)?
    12·2 answers
  • An IT security threat is anything that might cause serious harm to a computer system, including someone stealing a laptop that c
    8·2 answers
  • DRAG DROP -A manager calls upon a tester to assist with diagnosing an issue within the following Python script:#!/usr/bin/python
    11·1 answer
  • You are trying to connect a new USB device to your computer. You install the driver and then connect the device to an open USB
    10·1 answer
  • Which of the following statements describe the benefits of a career in transportation, distribution, and logistics (TDL)?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!