CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2014
    Posts
    1

    Problems with input/output file program.

    Code:
     cisDegree >> student_Identifier >> last_Name >> first_Name >> middle_Initial >> grade_Point_Average >> major_Char;
    	while (!cisDegree.eof())
    	{
    
    //Nested decision structure to write the information to the appropriate file according to their major.
    		if (major_Char == 'A')
    			appMajors << student_Identifier << " " << last_Name << " " << first_Name << " " << middle_Initial << " " << grade_Point_Average << " ";
    		else if (major_Char == 'N')
    			netMajors << student_Identifier << " " << last_Name << " " << first_Name << " " << middle_Initial << " " << grade_Point_Average << " ";
    		else if (major_Char == 'P')
    			progMajors << student_Identifier << " " << last_Name << " " << first_Name << " " << middle_Initial << " " << grade_Point_Average << " ";
    		else if (major_Char == 'W')
    			webMajors << student_Identifier << " " << last_Name << " " << first_Name << " " << middle_Initial << " " << grade_Point_Average << " ";
    		
    		cisDegree >> student_Identifier >> last_Name >> first_Name >> middle_Initial >> grade_Point_Average >> major_Char;
    	}
    I have all the variables declared, and all the files open, but for everywhere there is a >>, << before last_Name it says error 2679. im supposed to read the 6 variables from the input file and send them based on char to separate output files. Any idea on how to fix this error?

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,824

    Re: Problems with input/output file program.

    Error c2679 means "no operator found which takes a right-hand operand of type 'type' (or there is no acceptable conversion)".
    See http://msdn.microsoft.com/en-us/library/h1925w4w.aspx

    Of what type is last_Name? You haven't provided the definitions. It would be better if you showed the whole program so that we can better advise.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  3. #3
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Problems with input/output file program.

    Nothing to do with your question, but those aren't nested if statements.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured