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); }
B-tree: A B-tree is an also called balanced m-way tree. A node of the tree may have many records or key and pointers to children. It is also called as the balanced sort tree. It s
Inline Functions Imagine a c program, which reads disk records having employee information. If this is a payroll application each employee record data is probably processed by
1) Factorial (for this question just provide an answer for each part) 1.1 Debug the following program to calculate N! #include using namespace std; main()
#questiowrite a program to calculate e^x
In this problem you are given a board in which some of the elements are placed as shown in diagram below. Each element represents a color. Fill the other elements in the board, suc
Write a program that accepts two real numbers from a user and a select code. If the entered select code is 1, have the program add the two previously entered numbers and display t
define a class for student
Define the Stream Oriented Data Files? There are two dissimilar types of data files called stream-oriented (or standard) data files and system-oriented (or low-level) data file
I want MODI method''s coding in c++ using all concepts of c++..please help me its my project work...
Encapsulation and Data Hiding The property of being a self-contained unit is known as encapsulation. The idea that the encapsulated unit can be used without knowing how it work
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