Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am doing this on C++ How would I put the contents of this file it into a string? The file contains lines of either

I am doing this on C++

How would I put the contents of this file it into a string?

The file contains lines of either a Roman Numeral or an Arabic Numeral

The lines should follow this format :

Roman numeral field 15 characters -

Arabic numeral field 4 characters

If a line only contains a Roman Numeral it needs to be converted into an Arabic Numeral and vice versa( I have already done this part)

My question is how would I put a Roman Numeral or an Arabic numeral from the file and into a string variable without taking in the rest of the blank space of the line?

Eg: Line from program:" 123 "

What I want in a string variable "123"

Line from program:" XXVII "

What I want in a string variable "XXVII"

File input begins:

XXVII

123

MCLXV

1975

File input ends

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions