Code://header file #ifndef MID_TERM_H #define MID_TERM_H class Mid_Term { public: //no argument constructor Mid_Term(); //constructor with arguments //Mid_Term(color, type); // member functions void settype(char type); void setcolor(char color); char getcolor(); char gettype(); //data members private: char c1; char t1; }; #endifCode://function file #include "mid_term.h" //no argument constructor Mid_Term::Mid_Term() { c1=' '; t1=' '; } //constructor with arguments //"set" functions (normally without return type) void Mid_Term::settype(char a) { t1=a; } void Mid_Term::setcolor(char b) { c1=b; } // "get" functions (normally have return type) char Mid_Term::getcolor() { return c1; } char Mid_Term::gettype() { return t1; }Code://main file #include<iostream> #include<fstream> #include<iomanip> #include"mid_term.h" using namespace std; void main() { //define variables char aa; char type; char color; char response; float size; float price; char imported; Mid_Term mt; //cl /EHsc midtermDriver.cpp //print title cout<<"Rebecca Zbyradowski\nCIS326\nMidterm\n\n"; cout<<"Default Object\n\n"<<endl; cout<<"Type: Cheerleading\nColor: White\nPrice: $39.99\nSize: 9\nThis shoe is imported"<<endl; cout<<"-----------------------------------------"<<endl; //set up loop so program can end do{ cout<<"To Design your own footwear please enter values\n"<<endl; cout<<"Please select type:\n\n"; //Print Type cout<<"F:Flipflops\nS:Sandals\nD:Dress\nB:Boots\nT:Tennis\nH:Hiking\nK:Basketball\nC:Casual\nL:Cheadleader\nO:Football\n"; cin>>type; mt.settype(type); cout<<"\nPlease select Color:\n\n"; cout<<"W:White\nB:Black\nY:Yellow\nN:Brown\nR:Red\nG:Gray\nP:Purple\nS:Silver\n"; cin>>color; mt.setcolor(color); cout<<"\n\nWhat is the size?\n"; cin>>size; cout<<"\n\nWhat is the price?\n"; cin>>price; cout<<"Is this footwear imported?\n"; cin>>imported; cout<<"*** Your footwear specifics***\n\n"; //char type1; //type1=shoe.gettype(); switch (type) { case 'F': case 'f': cout<<"Type: Flipflop\n"; break; case 'S': case 's': cout<<"Type: Sandals\n"; break; case 'D': case 'd': cout<<"Type: Dress\n"; break; case 'B': case 'b': cout<<"Type: Boots\n"; break; case 'T': case 't': cout<<"Type: Tennis\n"; break; case 'H': case 'h': cout<<"Type: Hiking\n"; break; case 'K': case 'k': cout<<"Type: Basketball\n"; break; case 'C': case 'c': cout<<"Type: Casual\n"; break; case 'L': case 'l': cout<<"Type: Cheerleader\n"; break; case 'O': case 'o': cout<<"Type: Football\n"; break; default: cout<< endl << endl; cout<< "TYPE: Invalid Choice entered." << endl; break; }//end switch //char color1; //color1=shoe.getcolor(); switch (color) { case 'W': case 'w': cout<<"Color: White\n"; break; case 'B': case 'b': cout<<"Color: Black\n"; break; case 'Y': case 'y': cout<<"Color: Yellow\n"; break; case 'N': case 'n': cout<<"Color: Brown\n"; break; case 'R': case 'r': cout<<"Color: Red\n"; break; case 'G': case 'g': cout<<"Color: Gray\n"; break; case 'P': case 'p': cout<<"Color: Purple\n"; break; case 'S': case 's': cout<<"Color: Silver\n"; break; default: cout<< endl << endl; cout<<"COLOR: Invalid choice!"<< endl; } cout<<"Price: $"<<price<<endl; cout<<"Size: "<<size<<endl; if (imported == 'y') { cout<<"The shoe is imported.\n"<<endl; } else { cout<<"The shoe is made locally.\n"<<endl; } cout<<"Do you want to try again? (y/n)\n"; cin>>response; }while (response != 'n');//end of do while loop }//end main
I am getting an error when i trry to run it and i cant understand why..HELP
I have screen shot of error...




Reply With Quote