Example #1
0
int main()
{
//DECLARATION OF VARIABLES
    Vlist list;
    string function;
    string title;
    string url;
    string comment;
    double length;
    int rating;
//START OF WHILE LOOP
    while (getline(cin,function))
    {
        if (function == "insert") //CALLS THE INSERT FUNCTION FROM CLASS VLIST IF FUNCTION = "insert"
        {
            getline(cin,title);
            if (list.title_exists(title) == false)
            {
                getline(cin,url);
                getline(cin,comment);
                cin >> length;
                cin >> rating;
                cin.ignore();
                Video *video = new Video(title,url,comment,length,rating);
                list.insert_sorted(video);
            }
            else //TITLE ALREADY EXISTS SO DISPLAY ERROR MESSAGE
            {
Example #2
0
int main()
{
    //Declare and Initalize Local Variables.
    
    bool error_state = false;

    int rating = 0, number_of_videos = 0;
    float length = 0.0;

    string command, input_string, title, url, comment;
    string video_rating = "rating";
    string video_length = "length";
    string video_title  = "title";

    Vlist vlist;

    //Read input
   
        while(getline(cin, command))
        {
            //Determine which command was entered

            if (command == "insert")
            {
              getline(cin, input_string);
              title = input_string;
              getline(cin, input_string);
              url = input_string;
              getline(cin, input_string);
              comment = input_string;
              cin >> length;
              cin >> rating;


              //Get rid of extraneous live feed.
          
                 cin.ignore();

                 error_state = vlist.insert(title, url, comment, length, rating);

                 if (error_state)
                 {
                    cerr << "Could not insert video <" << title << ">, already in list." << endl;
                 }
            }
            else if (command == "print")
Example #3
0
File: value.cpp Project: iwag/lsch
static Value make_lambda( const Vlist& params, const Vlist& body ){
 	Vlist	vl;
	vl.push_back( Primitive::SYMBOL_LAMBDA ); 
	vl.push_back( params ); 
	vl.insert( vl.end(), body.begin(), body.end() );
	return Value( vl );
}