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
A: Use references when you can use, and use pointers when you have to. References are generally preferred over pointers whenever you don't require "reseating". Usually this mean

if one won't explicitly call the destructor of a local; then how does he handle the above situation?

want the codings for these topic in ur experts minds.com

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with thes

A: Use a member while you can and a friend when you need to. Sometimes friends are better syntactically (e.g., in class Fred, friend functions let the Fred parameter to be secon

How much does it cost to complete a C++ assignment that is 80% finished??

#include #include #include #include #include //*Variables Used in Programs*// int k; int l; int d; int won; int loss; int cash = 500;


Public, Private and Protected members: Class members can either be declared in public','protected' or in the 'private' sections of the class. But as one of the features of OOP i

A: In C, encapsulation was completed by making things static in a compilation unit or module. It prevented another module from accessing the static stuff. (Incidentally, now static