Help - where am I screwing up/

This is a discussion on Help - where am I screwing up/ within the C++ Programming forums, part of the General Programming Boards category; This is for final project and this is last part that needs completed, I don't understand why its giving me ...

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    7

    Question Help - where am I screwing up/

    This is for final project and this is last part that needs completed, I don't understand why its giving me problems. It is fine except for this one part of the code.

    Code:
    system("cls");
    	system("color 8A");
    	char runAgain;
    	tripEntry travels[100];
    	int counter = 0;
    	
    	do
    	{
    		do
    		{
    			cout << "Enter the trip ID number: ";
    			cin >> travels[counter].ID;
    			cout << "Enter the distance traveled on " << travels[counter].ID << ":";
    			cin << travels[counter].distance;
    			cout << "Enter the amount you are reimbursed per mile." << endl << "     (I.E.  0.25 for 25 cents)     ";
    			cin >> travels[counter].reimburse;
    			cout << "Add another trip? [Y/N]  ";
    			cin >> runAgain;
    			counter++;
    			runAgain = toupper(runAgain);
    		}while(runAgain == 'Y');
    
    		system("cls");
    
    		print_Top();
    		cout << VTUBE << " Trip ID     Miles     $/Mile     Reimburstment " << VTUBE << endl;
    		print_Mid();
    		for (int count =0; count<counter;count++)
    			cout << VTUBE << setw(8) << travels[count].ID << setw(10) << travels[count].distance << setw(6) << "$" << setw(5) << travels[count].reimburse << setw(12) << "$" << setw(6) << travels[count].distance * travels[count].reimburse << setw(2) << VTUBE << endl;
    
    		print_Bottom();
    
    		cout << "Do you want to make another? ";
    		cin >> runAgain;
    		runAgain = toupper(runAgain);
    
    	}while (runAgain =='Y');
    I have tried making HANDLE's to send it out specifically.

    I have to use ifstream and ofstreams in another part of the program, but don't seem to have an impact on any other parts.

    The errors I get are:
    Error 32 error C2784: 'std::basic_ostream<_Elem,_Traits> &std:perator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,720
    On which line does the error message relate to?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    7
    All of the ones with 'cout' and 'cin'.

  4. #4
    Registered User
    Join Date
    Feb 2003
    Posts
    595
    Fix this line:

    Code:
    			cin << travels[counter].distance;
    You have << where you should have >>

  5. #5
    Registered User
    Join Date
    Oct 2008
    Posts
    7

    Lightbulb Wow!

    I am not only stupefied that I missed that, but that it caused 55 errors. I shouldn't be too surprised since I have looked so hard it for as long as I did.

    I thank you for the 2nd pair of eyes, to look at it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Conversion to bool screwing up my + overloading
    By Sharke in forum C++ Programming
    Replies: 35
    Last Post: 06-25-2009, 03:44 AM
  2. Replies: 2
    Last Post: 06-06-2008, 10:10 AM
  3. My if statements are screwing up
    By gooey kablooey in forum C++ Programming
    Replies: 4
    Last Post: 03-19-2004, 10:32 AM
  4. Textures Screwing Up
    By Krak in forum Game Programming
    Replies: 2
    Last Post: 07-10-2003, 10:30 PM
  5. Replies: 4
    Last Post: 12-07-2002, 03:24 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21