Working with files in cpp, C/C++ Programming

Operation Files 2.1. Your program should open and read the file specified by the first command line argument of the program.

2.2. The first line of the file contains an integer that indicates the size with which to construct the SVector. Your program should catch the STL exception thrown by the STL vector class in main(), and report it before terminating.

2.3. Each line of the file starts with a char. 2.3.1.If the char is a 'U', then there is an integer followed by a string on the line with which to call push_back.

2.3.2.If the char is an 'A', then it is followed by a string with which to access the SVector using []. Your program should print out the corresponding integer, or throw an exception if the string is an invalid index.

2.3.3.If the char is an 'O', then it is followed by nothing. Normally, your main() should print nothing, but it should catch the exception if the vector is empty. Your SVector::pop_back() should update the map so the string to int mapping is removed. This is a little tricky, since you have only the int from the vector size() with which to work.


Posted Date: 3/6/2013 2:50:07 AM | Location : United States

Related Discussions:- Working with files in cpp, Assignment Help, Ask Question on Working with files in cpp, Get Answer, Expert's Help, Working with files in cpp Discussions

Write discussion on Working with files in cpp
Your posts are moderated
Related Questions
In this assignment the main has been written for you in the file phone_book_main.cpp. You will also notice that a class called Person has been declared as having several prototypes

Create Complex number using constructor: class complex                                 {                                                   private:

Ravi is a newbie to the programming and while learning the programming language he came to know the following rules: · Each program must start with ''''''''{'''''''' and end wi

C Program for 5 FUNCTION OF VOWELS, CNT_WORDS, REVERSE void input(char a[]); void output(char a[]); void reverse(char a[], char b[]); char poli(char a[], char b[]);

For this program you will add and test 2 new member functions to the IntSLList class posted on the website. The two member functions are: insertByPosn(int el, int pos) Assuming t

Write a c++ program to find the sum of 0.123 ??103 and 0.456 ??102 and write the result in three significant digits

A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concatenation.

This is what I need help with. "Create a program creates an interface allowing the user to select from some other programs I have made one being a money converter and the other ca

# c pragram TO count the number of occurances of the string in nth padovan''s string program in java // aakash , suraj , prem sasi kumar kamaraj college program 1 : pa