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
madreJ [45]
2 years ago
6

Write a function that converts a string into an int. Assume the int is between 10 and 99. Do not use the atoi() or the stoi() fu

nction.
Computers and Technology
1 answer:
Liula [17]2 years ago
6 0

Answer:

Written in C++

#include <iostream>

#include <sstream>

using namespace std;

int main()  {

   string num;

   cout<<"Enter a number: ";

   cin>>num;

   stringstream sstream(num);

   int convertnum = 0;

   sstream >> convertnum;

   cout << "Output: " << convertnum;

}

Explanation:

Without using atoi() or stoi(), we can make use of a string stream and this is explained as follows:

This line declares a string variable num

   string num;

This line prompts user for input

   cout<<"Enter a number: ";

This line gets user input

   cin>>num;

This line declares a string stream variable, sstream

   stringstream sstream(num);

This line declares and initializes the output variable, convertnum to 0

   int convertnum = 0;

The stream is passed into the output variable, convertnum

   sstream >> convertnum;

This line displays the output

   cout << "Output: " << convertnum;

<em>Note that: if user enters a non integer character such as (alphabet, etc), only the integer part will be convert.</em>

<em>For instance,</em>

<em>40a will be outputted as 40</em>

You might be interested in
Please answer quick:))))
Anika [276]
I think B and the second one C
8 0
2 years ago
Describe the data update difference between operational and analytical data.
crimeas [40]

Operational data is used to sustain applications that help facilitate operations.

These databases are directed to as application-oriented. Analytical data is used to examine one or more business areas, such as sales, costs, or profit

<h3>What is the distinction between operational and information-analytical systems?</h3>

Operational systems are prepared to deal with the running values of data. Informational Systems deal with the collection, collection, and deriving of information from data.

<h3>What is the distinction between operational and analytical reporting?</h3>

Analytical reporting is introduced toward supporting the strategic and preparing functions of senior management.

Functional reporting is oriented toward helping the day-to-day organizational functions.

To learn more about Operational data, refer

brainly.com/question/22670650

#SPJ4

7 0
1 year ago
Match the limits of the user with an appropriate design response. 1. severe arthritis, unable to type or use a mouse on a reliab
ololo11 [35]
Idk........................
4 0
3 years ago
HELP ME PLEASE !!!!!!!!!!
Snezhnost [94]

Answer:

the last one

Explanation:

8 0
3 years ago
Pig Latin is ______ and fits very naturally in the pipeline paradigm while SQL is instead declarative.
alisha [4.7K]

Answer:

Option b) is correct

Explanation:

Pig Latin is a language game in which English words are altered either by adding a suffix or such kind of suffix can be created by adding a syllable (vocalic). For example, ''hello'' becomes ''ello-hay''.

Pig Latin is <u>procedural</u> and fits very naturally in the pipeline paradigm while SQL is instead declarative.

3 0
2 years ago
Other questions:
  • A technician wants to create a new partition on a new additional hard drive. what tool should be used?
    15·1 answer
  • 2 negative impact of excessive use of computer even in solving mathematical problem.
    11·1 answer
  • How to tell if motherboard has bluetooth?
    8·1 answer
  • Which of the following dimensions of e-commerce technology involves the integration of video, audio, and text marketing messages
    11·1 answer
  • Extinction of a species is always a negative impact on the Earth.<br><br> True<br> False
    8·1 answer
  • I love dog my is 16 weeks old how old is yours
    12·1 answer
  • The icon below represents the ____________.
    8·1 answer
  • “identify the skill in the following scenario” :
    6·2 answers
  • What is the difference between MySQL and MariaDB?
    9·1 answer
  • he attributes for an iframe are controlled by CSS. One of the iframe controls is "seamless." This means it _____. will blend the
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!