Thread: Help with the rest of this program

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    2

    Manipulating Vectors and Strings

    here is sample data:
    *CSC121
    John Jones
    Mary Kelly
    *MTH453
    Mary Kelly
    James Johnson

    Given a collection of class rolls, this program allows the advisor
    to extract a list of all the courses taken by a given student. */

    #include <iostream>
    #include <iomanip>
    #include <fstream>
    #include <strstream>
    #include <string>
    #include <vector>
    #include <sstream>
    using namespace std;
    Code:
    int main()
    {
    
    	string filename;
    	string str;
    	string Name;
    	vector<string> studentName;
    	vector<string> course;
    
    	cout<<"Please enter the file name where the class rolls are stored:"<<endl;
    	cin>>filename;
    
    	ifstream istr(filename.c_str());
    
    	while ( getline(istr, str) ) {
    		istringstream istr(str.c_str());
    		cin >> str;
    		while (str != "*"){
    			studentName.push_back(str);
    		cin >> str;
    		}
    	}
    	
    		while (str == "*"){
    			course.push_back(str);
    		cin >> str;
    		}
    
    
    cout<<"Enter the first name, a space, and last name of the student you are searching for:"<<endl;
    cin<<Name;
    can anyone shed any light on this??
    Last edited by kroogs; 09-16-2003 at 04:35 PM.

  2. #2
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    I can shed some light on the board rules and suggest a specific title for your threads.
    Away.

  3. #3
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    What exactly is your specific question?

  4. #4
    Registered User
    Join Date
    Sep 2003
    Posts
    2

    manipulating the vectors

    I need help with searching the vectors to display all the classes a particular student appears in.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  2. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  3. need help on C++ program
    By tezr87 in forum C++ Programming
    Replies: 1
    Last Post: 06-01-2006, 04:40 AM
  4. Starting new program with function
    By trancedeejay in forum C Programming
    Replies: 14
    Last Post: 12-12-2005, 05:55 PM
  5. I need some help with my program please.
    By agentxx04 in forum C Programming
    Replies: 9
    Last Post: 09-26-2004, 07:51 AM