4 Replies - 4463 Views - Last Post: 22 July 2009 - 06:35 PM Rate Topic: -----

#1 vwyodapink   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 141
  • Joined: 12-May 09

I keep receiving error C2784

Post icon  Posted 22 July 2009 - 02:47 PM

I have started a C++ class and I am just in the very beginning and I am working on a excercise and I keep receiving an error C2784, even though for the 2 first excercises I did today everything worked fine. The difference was I loaded a solution file for the first two, they had to be converted but everything worked. This one was a new project file I started. I am using Visual Studio 2008.

#include <iostream>

using std::cout;
using std::cin;
using std::endl;

int main()
{
	//declare variables
	double beginningBalance = 0.0;
	double deposit = 0.0;
	double withdrawal = 0.0;
	double endingBalance = 0.0;

	//enter input items
	cout << "Enter your beginning balance: ";
	cin >> beginningBalance;
	cout << "Enter your deposit amount: ";
	cin >> deposit;
	cout << "Enter your withdrawal amount: ";
	cin >> withdrawal;

	//calculate ending balance
	endingBalance = beginningBalance + deposit - withdrawal;

	//display output items
	cout >> "Your ending balance is $" << endingBalance << endl;

	return 0;
} // end of main function




this is the error the compiler says:
1>------ Build started: Project: Ch3AppE04 Project, Configuration: Debug Win32 ------
1>Compiling...
1>Ch3AppE04.cpp
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,unsigned char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(1021) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,unsigned char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(1021) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,unsigned char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(1021) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,unsigned char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(1021) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,unsigned char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(1014) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,unsigned char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(1014) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,unsigned char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(1014) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,unsigned char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(1014) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,signed char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(1007) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,signed char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(1007) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,signed char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(1007) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,signed char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(1007) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,signed char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(1000) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,signed char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(1000) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,signed char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(1000) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,signed char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(1000) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,_Elem &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(975) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,_Elem &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(975) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,_Elem &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(975) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,_Elem &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(975) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,_Elem *)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(934) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,_Elem *)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(934) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,_Elem *)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(934) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2784: 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,_Elem *)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ostream'
1> c:\program files\microsoft visual studio 9.0\vc\include\istream(934) : see declaration of 'std::operator >>'
1>c:\users\jeremy\my dropbox\florida tech online\summer 2 2009\c++\chap3 homework and lesson work\ch3appe04 solution\ch3appe04 project\ch3appe04.cpp(32) : error C2676: binary '>>' : 'std::ostream' does not define this operator or a conversion to a type acceptable to the predefined operator
1>Build log was saved at "file://c:\Users\Jeremy\My Dropbox\Florida Tech Online\Summer 2 2009\C++\Chap3 homework and lesson work\Ch3AppE04 Solution\Ch3AppE04 Project\Debug\BuildLog.htm"
1>Ch3AppE04 Project - 25 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Is This A Good Question/Topic? 0
  • +

Replies To: I keep receiving error C2784

#2 apw5020   User is offline

  • D.I.C Addict

Reputation: 78
  • View blog
  • Posts: 666
  • Joined: 26-March 09

Re: I keep receiving error C2784

Posted 22 July 2009 - 02:48 PM

Take a look at this line:
cout >> "Your ending balance is $" << endingBalance << endl;
Does it look right to you?

This post has been edited by apw5020: 22 July 2009 - 02:54 PM

Was This Post Helpful? 1
  • +
  • -

#3 gareth00   User is offline

  • New D.I.C Head

Reputation: 5
  • View blog
  • Posts: 49
  • Joined: 08-May 09

Re: I keep receiving error C2784

Posted 22 July 2009 - 02:49 PM

Im pretty sure you could fix this by removing all your existing using "" entries and just putting

using namespace std;

EDIT: nevermind I think the way you did that is correct.

This post has been edited by gareth00: 22 July 2009 - 02:51 PM

Was This Post Helpful? 0
  • +
  • -

#4 deery5000   User is offline

  • D.I.C Lover

Reputation: 88
  • View blog
  • Posts: 1,097
  • Joined: 09-May 09

Re: I keep receiving error C2784

Posted 22 July 2009 - 06:15 PM

apw is correct :)

happens to the best of us at time , call it a typo

cout <<
cin >>

look at the line apw has posted for you

Hope this helps
Kevin
Was This Post Helpful? 0
  • +
  • -

#5 sherinfee   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 13
  • Joined: 27-June 09

Re: I keep receiving error C2784

Posted 22 July 2009 - 06:35 PM

you said that you have just started c++,ha?
be more careful at "cin and cout" i mean "<< and >>"!
good luck!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1