Change this code to read in strings from a text file

Assignment Help C/C++ Programming
Reference no: EM13162461

Currently, my code takes in a string from a user, checks if the paranthesis are ballanced (as defined by my class) and also returns the variable from my line (also from my class). All I need help with at this point is that I'd like to change this code to read in strings from a text file (each line is a string), print out the line, if the parenthese are balanced (true or false), and then the variables. I want it to quit when there are no more lines to read.

 

int main(){

string s;

cout<<"Enter strings(q to quit):\n";

while(getline(cin,s)){

if(s=="q" || s=="Q")

break;

if(checkBalancedParentheses(s)){

cout<<"Parentheses balanced.\n";

}else{

cout<<"Parentheses not balanced.\n";

}

cout<<"Proccesed string: "<<processString(s)<<endl<<endl;

}

return 0;

}

Reference no: EM13162461

Questions Cloud

Compute the mass of a small piece of a neutron star : Assuming that a neutron star has the same density as a neutron, calculate the mass in kilograms of a small piece of a neutron star the size of a spherical pebble with a radius of 0.10 mm.
Will this firm produce in the short run : Fit-To-A-Tee, a "price-taking" T-Shirt design shop, has a schedule of total fixed costs, total variable costs, total costs and marginal cost
Calculate the concentrations of all species : Calculate the concentrations of all species in a 1.62 M Na2SO3 (sodium sulfite) solution. The ionization constants for sulfurous acid are Ka1=1.4x10^-2 and Ka2=6.3x10^-8.
Calculate the partial pressures of the gases : A mixture of gases contains 0.26 mole CH4, 0.38 mole C2H6, and 0.18 mole C3H8. The total pressure is 1.50 atm. Calculate the partial pressures of the gases.
Change this code to read in strings from a text file : code takes in a string from a user, checks if the paranthesis are ballanced (as defined by my class) and also returns the variable from my line (also from my class). All like to change this code to read in strings from a text file (each line is a str..
Explain how these three ions can be separated : describe how these three ions can be separated by adding NaI solution. Which will precipitate out first and last? Please solve and show EVERY step of the solution
How many milligrams of the radioisotope are still active : Fluorine-18, which has a half-life of 110 min, is used in PET scans. (see section 4.5.) If 100 mg of fluorine-18 is shipped at 8 A.M., how many milligrams of the radioisotope are still active if the sample arrives at the radiology laboratory at 1:..
Why is the ?ask not ?rmly stoppered during sublimation : Suppose you have a stoppered ?ask containing CO2 gas at room temperature and pressure. If the volume of your stoppered ?ask is 300.0 mL, the pressure in the room is 770 mm Hg, and the temperature in your work area is 22.0°C, how many moles of CO2 ..
Explain what temperature in degrees celsius : The activation energy of a certain reaction is 50.0 . At 22 , the rate constant is . At what temperature in degrees Celsius

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Make a game in which you guess a number

Make a game in which you guess a number between two set numbers to find the answer, the game should tell you if you are too low in your guess or too high. For example

  Flipflaps - game based on pancake sorting

The project is to design and write a C++ 11/FLTK game program with a graphical user interface.The game is based on "pancake sorting,", which actually has some mathematical significance.

  Output the even numbers from 1 to 10 in ascending order

Output the even numbers from 1 to 10 in ascending order, then the odd numbers from 10 to 1 in descending order: 2 4 6 8 10 9 7 5 3 1. in C++

  Write a c function to convert gallons-quarts-pints and cups

Write a C function named liquid() that is to accept an integer number and the addresses of the variables gallons, quarts, pints, and cups.

  Multidimensional arrays

multidimensional arrays to life, let's consider a specific example: How can you visualize a 4-dimensional array? How can you give meaning to each dimension this array has? What kind of application would such an array be useful for?

  Wrtie a function called gen_rand_double_array

Wrtie a function called gen_rand_double_array that generates 900 samples of size 22500 random numbers from U(10, 12). For each of these 900 samples, write a main funciton that calculates the mean and finds the simulated probability that the mean is b..

  Program to compute surface area of sphere using function

Write down a program in C++ to compute surface area of sphere using a function. As sample run, write down the surface areas of spheres with radii.

  Binary tree, print right view of it

Given a Binary Tree, print Right view of it. Right view of a Binary Tree is set of nodes visible when tree is visited from Right side.

  Calculate the trajectory of a soccer ball

Write a program to calculate the trajectory (flight path) of a soccer ball

  Create a file, shared.txt

When your program starts, it shall do the following:1. Create a file, SHARED.txt, in the current directory (cwd). 2. Write it's pid (Process ID) followed by a Carriage Return and Newline in the file.

  Const int num_years

How do you get this program to get both player input and then display results(As described on bottom) #include  const int NUM_YEARS=15;//The number of years const int NAME_SIZE=32;//The max size of the player name string

  Create a c++ console application

Objective: Create a C++ console application that will model the characteristics of a resistor. Create a multifile project. Create and add to the project an h file containing the resistor-class definition. Create and add to the project a cpp file cont..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd