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); }
write a program to calculate gross salary and net salary using hra da pf in c++
Queue - C++ program: Write a program to show the basic operations on queue. namespace stack { const int max_size = 200; char v(max_size); int top=0; void pu
within 2 mins give me answer pllzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
You are to implement a code cracking system. The system will deploy four processes (p1,p2,p3 & p4) to try to guess the password of an encrypted code. For encryption, we consider th
wap to cheak if a number is palindrom
How to write an inline class member function In addition to global functions, you may request that non-static member functions of a class be inlined. The normal method of doin
C and C++ require explicit dynamic memory management, using new and delete or malloc() and free(). It is helpful to understand where variables exist (usually the stack or the he
how to decode the numerals to string..
Within programs we very often want to execute a different section of code, depending upon various conditions within C the If statement is used to achieve this. The If statement con
A: A class which is used to traverse through the objects maintained through a container class. There are _ve categories of iterators: output iterators, input iterators, forward ite
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