Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

for my C++ lab i need to make a code that will take a user inputed number, and square it. then take the same user

for my C++ lab i need to make a code that will take a user inputed number, and square it. then take the same user inputed number (not the squared one) and divide it by three as well as show the remainder. this is the code right now which is diving the squared the number which i dont want. how could this be fixed? its working perfectly i just it to divide the user inputed number instead if the squared one as well as show the remainder. thanks
image text in transcribed
image text in transcribed
. X Microsoft.cpphudargas 2 usz Beinclude Ginclude Global Scopel edefine _CRT_SECURE_NO_JURNINGS LAB 2: Using Functions Developed by: Taitun Laroque Date: Jan 14, 2020 Description: //Function Prototypes void purpose(); int Getumber(); int square(int num): float DivideByThree(int), int RemaindertyThree(float); vold Display(int & Int se, float b, Intres); alat main() { INariable Declarations/user Inputs purpose(); int um. Getumber(); int e re( ); float res - DividelyThree(a) Int re RemindertyThree(s): Displayim, sa res, rem); while (U_ht(): I/keeps window open until keybored is pressed Purpose. This function prints the purpose of the program to the console. Eveld purpose(void) printf( this progres will take a user input and square it, divide by 9) printf(" and display the remainder) cer . This function rests the interme it to the calling function. Returned The Integer given from user ( int Gethumber() . X Global Scope of Copbuild targets LAB 2 64 Bint Get Number() int number: printf(" Please insert Integer value here :"); scanf("%d", &number); return number; Square - calculates the square of the integer and returns the result. Input: The number from the calling function (int) Returned: returns the squared value (int) Teint square(int num) return num ; DivideByThree - Divides the integer by three and returns the result. Input: The number from the calling function (int) Returned: Returns the divided number (float) Tefloat DivideByThrea(int nun) return ((float)num) / 3; RemainderbyThree - Calculates the remainder of the interer entered divided by and returns the result. Input: The number from the calling function (float) Returned returns the remainder (int) 102 Teint RemaindertyThree(float num) return ((int)nue) X 3; 510 Display - This function displays the result to the console Inputs: Results from getumber (Int), Square (int), DavidelyThree (float). RemainderbyThree (int) T void Display(int , int 14. float b. Int ree) printf("Number M . a); printf("squared Nd ". ) printf("DividetyThree X.af ", b) printf("RemainderbyThree Min", rem); printf(" boodbye), ound N Oulu Show output from Delag

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications 18th International Conference Dasfaa 2013 Wuhan China April 22 25 2013 Proceedings Part 2 Lncs 7826

Authors: Weiyi Meng ,Ling Feng ,Stephane Bressan ,Werner Winiwarter ,Wei Song

2013th Edition

3642374492, 978-3642374494

More Books

Students also viewed these Databases questions