{"id":113371,"date":"2023-01-23T14:38:03","date_gmt":"2023-01-23T14:38:03","guid":{"rendered":"https:\/\/assignmenttutors.net\/blog\/program-to-demonstrate-function-computer-science-homework-help\/"},"modified":"2023-01-23T14:38:03","modified_gmt":"2023-01-23T14:38:03","slug":"program-to-demonstrate-function-computer-science-homework-help","status":"publish","type":"post","link":"https:\/\/assignmenttutors.net\/blog\/program-to-demonstrate-function-computer-science-homework-help\/","title":{"rendered":"Program to demonstrate function | Computer Science homework help"},"content":{"rendered":"<div>\n<p>\u00a0\u00a0<\/p>\n<p>\/* Program to demonstrate function.*\/<\/p>\n<p>\u00a0Write a program which has two functions, the main function and the input function.<\/p>\n<p>The input function asks the user to enter an integer from 0 to 100, inclusive.<\/p>\n<p>In the input function:\u00a0<\/p>\n<p>\u2022 If the user enters a number that is out of the required range, the number is XXXXX returned to the main function; instead it prints an error message and then loops to ask the user to enter a correct number.\u00a0<\/p>\n<p>\u2022If the user enters a number in the required range, the number is XXXXX to the main function.<\/p>\n<p>\u2022If the user enters End Of File, the input function returns -1 to the main function.<\/p>\n<p>\u2022 When the main function receives -1 from the input function, it prints a completion message and the program ends.\u00a0<\/p>\n<p>\u2022 When the main function receives any other number, the main function prints it, and calls the input function again.\u00a0<\/p>\n<p>\u2022The input function does NOT print the numbers; they are only printed in the main function.<\/p>\n<p>\u2022Except for the -1, the main function prints all numbers returned to it from the input function.<\/p>\n<p>Hints:You might use a do&#8230;while loop in the main function, that runs as long as -1 is not returned. You might use a do&#8230;while loop in the input function, that loops as long as the user enters a number that is out of the required range. Make sure your program does not confuse the datum -1 with EOF, which is also -1Only code one return from each function.<\/p>\n<p>Test data: use each of the following values: 100 101 20 -5 0 9 -1 18\u00a0<\/p>\n<p>The main function should print 100 20 0 9 18 and a run completed message.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0\u00a0 \/* Program to demonstrate function.*\/ \u00a0Write a program which has two functions, the main function and the input function. The input function asks the user to enter an integer from 0 to 100, inclusive. In the input function:\u00a0 \u2022 If the user enters a number that is out of the required range, the number [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-113371","post","type-post","status-publish","format-standard","hentry","category-education"],"_links":{"self":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts\/113371","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/comments?post=113371"}],"version-history":[{"count":0,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts\/113371\/revisions"}],"wp:attachment":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/media?parent=113371"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/categories?post=113371"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/tags?post=113371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}