Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Write a function to calculate the exchange rate of pounds to dollars
Answer
Td = 2xTp The parameter passed over is the number of pounds and returned the value in dollars
float convert (float x ) { float y ; /*A function which converts pounds measure X to a dollars measure*/ /*The parameter x is real and a real value y is returned*/ y = 2.0 * x; return (y); } The program which calls the function would be include include include include include void main() { char prompt; float a, b; printf("please enter in your value in pounds \n\r"); scanf("%f",&a); b= convert(a); printf("The value in dollars is %5.3f \n\r",b); b= convert(3.0); printf("The value in dollars of 3 pounds is %5.3f \n\r",b); printf("Press any key to exit \n\r"); scanf("\n%c",&prompt); }
Here the program requests the value of a in pounds, then executes function 'Convert'. This causes the program to go to the function statement, pass the variable a, to it and the output is passed back to the program. The output is then assigned to variable b and printed out. It is possible to pass a value over instead of a variable. The only amendment we have to make is to add the prototype to the program i.e.
float convert (float); This describes the type of variables passed to and from the function. Therefore the complete program and function is shown below include include include include include float convert (float); void main() { char prompt; float a, b; printf("please enter in your in pounds \n\r"); scanf("%f",&a); b= convert(a); printf("The value in dollars is %5.3f \n\r",b); b= convert(3.0); printf("The value in dollars of 3 pounds is %5.3f \n\r",b); printf("Press any key to exit \n\r"); scanf("\n%c",&prompt); } float convert (float x ) { float y ; /*A function which converts pounds measure X to a dollars measure*/ /*The parameter x is real and a real value y is returned*/ y = 2.0 * x; return (y); }
Project Description: Need someone to prepare a trading platform and sophisticated trading strategy. Must have knowledge and experience in most of these: QuickFIX, Esper, Quan
There is a pebble merchant. He sells the pebbles, that are used for shining the floor. His main duty is to take the length of the room’s sides. But he sometimes mistakes doing that
Dynamic Initialization of objects: It is initializing the objects by passing the valued to the constructor from the user input or other means. Through cin operator a value
palindrome program with minimum character replacements
Classes and Objects A class is a vehicle to execute the OOP features in the C++ language. Once a class is declared, an object of that type can be explained. An object is said t
wap to count the numof string present in a word
The project is to design and write a C++11/FLTKgame program with a graphical user interface.The game is based on "pancake sorting," as described at http://en.wikipedia.org/wiki/P
Write a simple generic version of method isEqualTo that compares its two arguments with the equals method and returns true if they are equal and false otherwise. Use this generic m
direction[] = {L,R,R,L,L,R,R,R,R,L,Z} length[]= {2,2,1,1,1,2,5,2,2,3,1}
(a) Write a procedure called (area-of-rectangle h w) that computes the area of a rectangle of height h and width w. (b) Write a procedure called (area-of-circle r) that computes
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +1-415-670-9521
Phone: +1-415-670-9521
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd