Monday, May 24, 2010

What am I doing wrong here in my c++?

/***************************************...


*


* Program name: Lab 10


* Author : Daniel J. Carr


* Date : December 10th, 2007


* Course/selection: CSC-110-003


* Program Description:


*


*


*


**************************************...





/************************** Compiler Directives **********************/


// libraries


#include %26lt;iostream%26gt;


#include %26lt;iomanip%26gt;


#include %26lt;cmath%26gt;





using namespace std;


/*********************** Global Data Declarations ********************/





/*************************** Function Prototype **********************/





void chop(float chipmunk, int%26amp; head, float%26amp; tail);








/*************************************...


*


* Function name: Main


* Author: Daniel J. Carr


* Date: December 10th, 2007


* Function Description:


*


* Pseudocode:


* Level 0


* -------


* Enter a float


* Chop it


* Output pieces


*


*


* Level 1


* -------


* Enter a float


* Display "Enter a floating point number----%26gt; "


* Input Chipmunk


* Chop it


* Call funtion chop to split chipmunk into head and tail


* Output Pieces


* Display "The whole number---%26gt; "%26amp; head %26amp; EOL


* Display "The Deciman number-%26gt; "%26amp; tail %26amp; EOL


*


**************************************...


int main()


{


//Varables


float chipmunk;


int head;


float tail;











cout %26lt;%26lt; "Enter a floating point number----%26gt; " %26lt;%26lt; endl;


cin %26gt;%26gt; chipmunk;








//Call function chop





void chop(int%26amp; head, float%26amp; tail);


cout %26lt;%26lt; "The whole number----%26gt; "%26lt;%26lt;%26amp; head %26lt;%26lt; endl;


cout %26lt;%26lt; "The Decimal number--%26gt; "%26lt;%26lt;%26amp; tail %26lt;%26lt; endl;








//Indicate successful termination of program





return 0;


}





//End main


/*************************************...


*


* Function name: Chop


* Author: Daniel J. Carr


* Date: December 4th


* Function Description:


*


*


*


* Pseudocode:


* Level 0


* -------


* Chop it


*


* Level 1


* -------


* Chop it


* whole = int(number)


* Decimal =|number-whole|


*


**************************************...





void chop(float chipmunk,int%26amp; head, float%26amp;tail)


{


// Variables








// Arguements


chipmunk = head;


tail = abs(chipmunk-head);








}

What am I doing wrong here in my c++?
dude I hope this will help you. I think the Scripts website has answer
Reply:Try this instead:


cout %26lt;%26lt; "The whole number----%26gt; "%26lt;%26lt; head %26lt;%26lt; endl;


cout %26lt;%26lt; "The Decimal number--%26gt; "%26lt;%26lt; tail %26lt;%26lt; endl;
Reply:I would like to help but a part of a classroom assignment is to make you learn this on your own without having someone answer it for you. There are several ways to do this simple assignment. There are predefined functions that do this for you. I would assume your professor wants you to write some code that doesn't user predefined functions. I would think text.


No comments:

Post a Comment