hi everybody
i have two programs and i need your help to write the please write me the code as soon as possible.
Question 1:
Write a program that checks if an integer value entered by the user is present in a file or not. If present, the program should indicate the order of this value in the file i.e. it is value number 1, or value number 20 etc…
Your program should also check the file not found error case. In the first run shown below, the file was not in the folder. In the remaining runs, the file is there and the messages displayed by the program are shown. The number of values in the file is unknown. Assume that they are not repeated i.e. each value is written only once.
Note: You should stop searching once you find the value you are looking for. You can use a logical variable and keep looking for the value of the user as long as it is not found and you did not reach the end of the file. Both conditions should be included in the loop.
Question 2:
Write an interactive program that displays a menu ( use do-while) containing many choices as shown below:
1- split a real number
2- check if a number is perfect square
3- check if a number is prime
4- check if a number is odd
5- Exit
You have to write 5 functions as indicated below:
Function 1 to display the choices shown above.
Function 2 to receive a real value and return its whole part and decimal part separately (not print them); split function
Function 3 is a logical function that receives a positive integer number and returns 1 if it is perfect square, 0 otherwise. Perfect squares are 4,9,16,25 etc…
Function 4 is a logical function to receive a positive integer number and returns 1 if it is prime, 0 otherwise.
Function 5 is also a logical function to check if an integer number is odd or not.
In the main function, your program will ask the user to select a choice then, read the data and call the right function and print the right message. Sample runs of your programs are shown below.
for sample output
_
http://myfreefilehosting.com/f/7d74d2cea0_0.14MB
thanks for help .