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
Ask question #Minimum 100 words acceptedEducational Objectives: After completing this assignment, the student should be able to accomplish the following: Apply generic algorithms i

Problem 1 What is the difference between function declaration and function definition? 2 Write a recursive function to find sum of even numbers from 2 to 10. 3 List some

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

#padovan string in java   program in java // aakash , suraj , prem sasi kumar kamaraj college program 1 : package test.padovanstring; public class PadovanStrin

Poker Room auto seat program Project Description: I want a script for an online poker site. It requires to be scanning all the available tables and when the table meets certa

Your task is to create a programming system for a ferry. The ferry transports passengers and vehicles (cars, busses, lorries and bicycles). The ferry has space for 200 passengers a

You are to implement a code cracking system. The system will deploy four processes (p1,p2,p3 & p4) to try to guess the password of an encrypted code. For encryption, we consider th

Q: In p = new Fred(), does the Fred memory "leak" if  Fred constructor throws an exception? A: No.         If an exception take place during the Fred constructor of p = new F

I need help with virtual memory manager implementation in C

Simpson's Rule is a more accurate method of numerical integration than the method described in class. Using Simpson's Rule, the integral of a function f between a and b is approxim