Monday, May 24, 2010

VIsual C++ computer programing please help me?

Hello, Im a bio majore that for some reason is being forced to take computer programming. IT sucks, I really need help on this program so please help me if you can it would be really greatly appreciated. This isi our assignement


Write a program to convert between yards and meters. Your solution must utilize functions to perform the conversions. Your functions must meet these requirements:





One of the functions must use pass-by-value, returning the converted measure


One of the functions must use pass-by-reference to store its result (the function does not have a return value).


Your program must create two tables - one showing the yards equivalent to meter measures from 0 yards to 100 yards (by 5 yard increments: 0, 5, 10, . . . , 100) and the other showing meters equivalent to yards measures 0 through 100 (by 5 meter increments: 0, 5, 10, ... , 100). Original measures are all integer values. Calculated measures are to be displayed accurate to two decimal places.


The output for both tables must fit on one default screen (79 columns by 23 rows), so your tables will need to be organized into multiple columns. Everything must be lined up nicely and the tables neatly and informatively labeled. This assignment can be done with a single file. It is not necessary to define any classes

VIsual C++ computer programing please help me?
If you still need help you may contact a C++ expert at websites like http://askexpert.info/
Reply://here is a starting point


//figure out how to change the printfs to using cout...





#include %26lt;stdio.h%26gt;





//conversion factors


float y2m=1.09361329834


float m2y=0.9144





main ()


{


int i;


float yards, meters;





for (i=5; i%26lt;=100; i=i+5)


{


yards=getyards(i);


printf("%d meters = %3.2f yards\n",i,yards);


}


for (i=5; i%26lt;=100; i=i+5)


{


getmeters(i,%26amp;meters);


printf("%d yards = %3.2f meters\n",i,meters);


}


} //end main





float getyards(int x)


{


return (x*m2y)


}





void getmeters (int x, float %26amp;m)


{


*m=(x*y2m);


return()


}
Reply:its easy.


Start with


three integers.


then create a switch statement to display a message to convert from yard to meter or meter to yard.


User enters choice. Then uses function to calculate it.

clear weed

No comments:

Post a Comment