C++ beginner
-
Sunday, November 01, 2009 3:28 PM
Just started C++ having trouble with code,if anyone could help would appreciate it...
//C++ Programming
//Programming Assignment
//Grading Criteria
#include
<iostream>
#include
<iomanip>
using
namespace std;
int
main()
{
int accountNumber; //customers account number
double BegBalance; //customers beginning balance
double NewBalance; //customers balance after calculations
double charges; //charges on account
double credits; //credits to the account
double limit; //credit limit on account
//Get the customers account number
cout <<
"Enter account number (-1 to end): " << fixed;
cin >> accountNumber;
//Format the currency input
cout << showpoint << setprecision(2);
while (accountNumber > -1)
{
cout <<
"Enter beginning balance: ";
cin >> BegBalance;
cout <<
"Enter total charges: ";
cin >> charges;
cout <<
"Enter total credits: ";
cin >> credits;
cout >>
"Enter credit limit: ";
cin >> limit;
//Calculate the customers balance
NewBalance = BegBalance + charges - credits;
cout <<
"Account: " << accountNumber << endl;
cout <<
"Credit Limit: " << limit << endl;
cout <<
"Balance: " << NewBalance << endl;
if (NewBalance > limit)
cout <<
"Credit Limit Exceeded.\n";
cout <<
"\nEnter account number (-1 to end): ";
cin >> accountNumber;
}
return 0;
}
1>c:\users\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : error C2784: 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,const std::_Smanip<_Arg> &)' : 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\iomanip(69) : see declaration of 'std::operator >>'
1>c:\users\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : error C2784: 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,const std::_Smanip<_Arg> &)' : 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\iomanip(69) : see declaration of 'std::operator >>'
1>c:\users\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : error C2784: 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,const std::_Smanip<_Arg> &)' : 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\iomanip(69) : see declaration of 'std::operator >>'
1>c:\users\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : error C2784: 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,const std::_Smanip<_Arg> &)' : 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\iomanip(69) : see declaration of 'std::operator >>'
1>c:\users\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : error C2784: 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,const std::_Fillobj<_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\iomanip(36) : see declaration of 'std::operator >>'
1>c:\users\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : error C2784: 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,const std::_Fillobj<_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\iomanip(36) : see declaration of 'std::operator >>'
1>c:\users\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : error C2784: 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,const std::_Fillobj<_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\iomanip(36) : see declaration of 'std::operator >>'
1>c:\users\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : error C2784: 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,const std::_Fillobj<_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\iomanip(36) : see declaration of 'std::operator >>'
1>c:\users\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\daddy\documents\visual studio 2008\projects\pa_grading\pa_grading\pa_grading.cpp(35) : 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\Daddy\Documents\Visual Studio 2008\Projects\PA_Grading\PA_Grading\Debug\BuildLog.htm"
1>PA_Grading - 33 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
All Replies
-
Tuesday, December 01, 2009 2:18 PMFirst and fore most at the begininning you need to inlude the standard library#include "stdafx.h"2nd the code needs to be:cout <<"Enter credit limit: ";You havecout >>"Enter credit limit: ";This should make it run just fine!
-
Thursday, April 05, 2012 6:32 AMYou are definately right!


