6 Replies - 204 Views - Last Post: 04 March 2012 - 06:23 PM Rate Topic: -----

#1 ty2008  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 03-March 12

I have 3 programs & I am getting the same error C2679 binary "

Posted 03 March 2012 - 03:25 PM

Hear are the codes:

#include <iostream>
#include <string>

using namespace std;

int main()
{

	double number;

	cout<<"12.5:";
	cin>> 12.5;
	cout<<endl;

	cout<< "The integer nearest to " << 12.5 << " = "
		<< static_cast<int>(12.5 + 0.5); endl;

	return 0;
}



#include <iostream>
#include <string>

using namespace std;

int main()
{
	double originalprice;
	double markeduppercentage;
	double salestaxrate;
	double sellingprice;
	double salestax;
	double finalprice;

	cout<<"Enter the original price of the item: 12.00";
	cin>> 12.00;

	cout<<"Enter the marked up percentage: 100.0";
	cin>> 100.0;
	
	cout<<"Enter the sales tax rate: 8.0";
	cin>> 8.0;

	sellingprice = 12.00 + 12.00 * 100 / 100;
	salestax = 24.00 * .8/ 100;
	finalprice = 24.00 + .8;

	cout<<"The original price = $12.00" << originalprice << endl;
	cout<<"The price is marked up by" <<markeduppercentage
		<<"100%" <<endl;
	cout<<"The selling price = $24.00" <<sellingprice <<endl;
	cout<<"The sales rate =8%" <<salestaxrate <<"%" <<endl;
	cout<<"The sales tax = $0.80" <<salestax << endl;
	cout<<"The final price = $24.80" <<finalprice <<endl;

	return 0;
}



#include <iostream>

using namespace std;

int main ()
{
	double test1, test2, test3, test4, test5;

	double average;

	cout<<"Enter five test scores: 60 85 100 100 100 ";
	cin>> 60>> 85>> 100>> 100>> 100;
	cout<< endl;

	average = (60 + 85 + 100 + 100 + 100)/5.0;

	cout<< "Average test score:89 " << average<< endl;

	return 0;
}


This post has been edited by Karel-Lodewijk: 03 March 2012 - 03:34 PM
Reason for edit:: Added code tags, pls put yout code between [code] and [/code]


Is This A Good Question/Topic? 0
  • +

Replies To: I have 3 programs & I am getting the same error C2679 binary "

#2 Karel-Lodewijk  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 445
  • View blog
  • Posts: 849
  • Joined: 17-March 11

Re: I have 3 programs & I am getting the same error C2679 binary "

Posted 03 March 2012 - 03:32 PM

In future, give us the complete error message with line number, C2679 says as much to us as it says to you.

Anyway, I'm assuming the problem is lines like this one:

cin>> 12.00;



cin >> should be followed by a variable. It will then wait for the user to type something in the console and put whatever the user typed into that variable. So if you want the user to give you the original price, you would do something like:

cout<<"Enter the original price of the item: 12.00";
cin>> originalprice;



And then the originalprice variable will contain whatever the user entered.
Was This Post Helpful? 0
  • +
  • -

#3 shurd  Icon User is offline

  • D.I.C Head

Reputation: 37
  • View blog
  • Posts: 158
  • Joined: 05-February 12

Re: I have 3 programs & I am getting the same error C2679 binary "

Posted 03 March 2012 - 03:51 PM

  cout<< "The integer nearest to " << 12.5 << " = "<< static_cast<int>(12.5 + 0.5)/*;*/<< endl;



theres your problem, besides what Karel said

This post has been edited by shurd: 03 March 2012 - 04:01 PM

Was This Post Helpful? 0
  • +
  • -

#4 ty2008  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 03-March 12

Re: I have 3 programs & I am getting the same error C2679 binary "

Posted 03 March 2012 - 04:01 PM

Ok I have changed a few things and these are the errors I'm getting now.

F:\CIS 209\Chapter 1\exercise1-6.cpp(12) : error C2143: syntax error : missing ';' before ':'

F:\CIS 209\Chapter 1\exercise1-6.cpp(16) : warning C4551: function call missing argument list

#include <iostream>
#include <string>

using namespace std;

int main()
{

double number;

cout<<"12.5:";
cin>> number: 12.5;
cout<<endl;

cout<< "The integer nearest to " << 12.5 << " = "
<< static_cast<int>(12.5 + 0.5); endl;

return 0;
}






#include <iostream>
#include <string>

using namespace std;

int main()
{
double originalprice;
double markeduppercentage;
double salestaxrate;
double sellingprice;
double salestax;
double finalprice;

cout<<"Enter the original price of the item: 12.00";
cin>> originalprice: 12.00;

cout<<"Enter the marked up percentage: 100.0";
cin>> markeduppercentage: 100.0;

cout<<"Enter the sales tax rate: 8.0";
cin>> salestaxrate: 8.0;

sellingprice = 12.00 + 12.00 * 100 / 100;
salestax = 24.00 * .8/ 100;
finalprice = 24.00 + .8;

cout<<"The original price = $12.00" << originalprice << endl;
cout<<"The price is marked up by" <<markeduppercentage
<<"100%" <<endl;
cout<<"The selling price = $24.00" <<sellingprice <<endl;
cout<<"The sales rate =8%" <<salestaxrate <<"%" <<endl;
cout<<"The sales tax = $0.80" <<salestax << endl;
cout<<"The final price = $24.80" <<finalprice <<endl;

return 0;
}




#include <iostream>
#include <string>

using namespace std;

int main ()
{
double test1, test2, test3, test4, test5;

double average;

cout<<"Enter five test scores: 60 85 100 100 100 ";
cin>> test1: 60>> test2: 85>> test3: 100>> test4: 100>> test5: 100;
cout<< endl;

average = (60 + 85 + 100 + 100 + 100)/5.0;

cout<< "Average test score:89 " << average<< endl;

return 0;
}


This post has been edited by Karel-Lodewijk: 03 March 2012 - 04:42 PM
Reason for edit:: Added code tags, pls put yout code between [code] and [/code]

Was This Post Helpful? 0
  • +
  • -

#5 Karel-Lodewijk  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 445
  • View blog
  • Posts: 849
  • Joined: 17-March 11

Re: I have 3 programs & I am getting the same error C2679 binary "

Posted 03 March 2012 - 04:41 PM

cin>> number: 12.5;



This is still not right, use cin>> number;. I suppose you want a default value filled in nut there is no standard C/C++ way to accomplish something like that.

This is also not fixed yet.

cout<< "The integer nearest to " << 12.5 << " = "
<< static_cast<int>(12.5 + 0.5); endl;



Should be << endl; at the end instead of ; endl;

And please make some effort to fix these problems yourself. The error messages usually point you to the line where your problem is and should give you some hints on what could be wrong. Read and try to understand them.

This post has been edited by Karel-Lodewijk: 03 March 2012 - 04:45 PM

Was This Post Helpful? 1
  • +
  • -

#6 ty2008  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 03-March 12

Re: I have 3 programs & I am getting the same error C2679 binary "

Posted 04 March 2012 - 03:00 PM

I'm still having problems with this program here are the errors:

F:\CIS 209\Chapter 1\exercise1-9.cpp(8) : error C2601: 'test1' : local function definitions are illegal
F:\CIS 209\Chapter 1\exercise1-9.cpp(8) : error C2063: 'test1' : not a function
F:\CIS 209\Chapter 1\exercise1-9.cpp(8) : error C2969: syntax error : ';' : expected member function definition to end with '}'
F:\CIS 209\Chapter 1\exercise1-9.cpp(13) : error C2143: syntax error : missing ';' before ':'
#include <iostream>
#include <string>

using namespace std;

int main ()
{
	double test1: test2: test3: test4: test5;

	double average;

	cout<<"Enter five test scores; 60 85 100 100 100 ";
	cin>> test1: 60>> test2: 85>> test3: 100>> test4: 100>> test5: 100;
	cout<< endl;

	average = (60 + 85 + 100 + 100 + 100)/5.0;

	cout<< "Average test score:89 " << average<< endl;

	return 0;
}


:code:

This post has been edited by jimblumberg: 04 March 2012 - 06:18 PM
Reason for edit:: Added missing Code Tags, Please learn to use them.

Was This Post Helpful? 0
  • +
  • -

#7 jimblumberg  Icon User is online

  • member icon

Reputation: 3055
  • View blog
  • Posts: 9,292
  • Joined: 25-December 09

Re: I have 3 programs & I am getting the same error C2679 binary "

Posted 04 March 2012 - 06:23 PM

The first several errors are on line 8 which should be:
  double test1: test2: test3: test4: test5;


C/C++ does not use a colon as a separator, You would need a comma instead.

The next set of errors are on line 13:
  cin>> test1: 60>> test2: 85>> test3: 100>> test4: 100>> test5: 100;

There are quite a few problems with this line. You need to explain exactly what you are trying to do on this line. I can't tell what you actually intend this mess to accomplish.

Jim
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1