Question

KINDLY HELP SOLVE THE C++ SECURE SHELL DRILLS, RUN AND COMPILE THEM TO PERFORM THE TASK PERFECTLY. THANK YOU.

/1 Function: Complete the body of the Read _Kth Num function. #include <iostream> using namespace std; // Read the kth input//Function: Complete the MaxVal function #include iostream» using namespace std; void Maxal (int numl, int num2, int & ans) #/1 Function: Complete the ReadNum function so that it works correctly. #include <iostream> #include <fstream> using namespace//Function: Fix errors in the functions Prod and Sum, if there are any. #include iostream» using namespace std; int SuM(int 1/ Function: Complete the function Quotient. Return ZERO when divisor (num2) is ZERO. #include <iostream> using namespace std;

/1 Function: Complete the body of the Read _Kth Num function. #include using namespace std; // Read the k'th input value. DO NOT ISSUE A PROMPT // Example: when 3 and inputs are 4 6 8 10 12 the desired value is 8 void Read Kth Num (int k, int & value) tinclude "mainpt60300a.cpp"
//Function: Complete the MaxVal function #include iostream» using namespace std; void Maxal (int numl, int num2, int & ans) #include "mainpt60500a.cpp
/1 Function: Complete the ReadNum function so that it works correctly. #include #include using namespace std; int dHASH (int functID-1) I/DO NOT MODIFY THIS FUNCTION!! { static int hash = 1; hash += funct|D$3; return hash; } // Read integer value from input stream. DO NOT ISSUE A PROMPT int ReadNum (istream a myE dHASH: DO NOT MOVE, MODIFY OR DELETE. int main DO NOT TOUCH the main!! system("rm -f MD:echo 4 3 2781 MDII DO NOT MOVE, MODIFY or DELETE. ifstream myF("MD") //-1 Read intege int x, y: x = ReadNum (cin); y r x £rom the keyboard, and integer y from the file 'MD' ReadNum (myF) ; dHASH(x) ; 11- Output the sum of x and y. cout
0 0
Add a comment Improve this question Transcribed image text
Answer #1
  • I have completed the above problem as required to add/debug some line in the code.
  • i have attached the output of the source code for testing purpose.

Source code:-


#include <iostream>
using namespace std;

void Read_Kth_Num(int k, int & value)
{
   cin >> k;
   for (int i=1; i<=k-1; i++)
   {
     cin >> value;
   }

}


**********************************************

#include <iostream>
using namespace std;
void Max (int num1, int num2, int & ans)
{
if(num1 < num2)
   ans=num2;
else
   ans=num1;

   cout<<ans;
}
int main()
{
   int result=0;
   Max(5,9,result);
  
   return 0;
}

***********************************************************************

#include <iostream>
using namespace std;
int Sum(int l, int m) { return l+m; }
int Prod(int p, int q) {return p*q; }
void Show(string w1, string w2, int value)
{ cout << endl << ":" << w1 << value << w2 << endl; }
int main()
{
   int a,b,answer;

   cin >> a >> b;

   answer = Prod(a,b) + Sum(b,b);
   Show("ANS = ", ":", answer);

   return 0;
}

***********************************************************************************

#include <iostream>
using namespace std;

int Quotient(int num1, int num2)
{
if (num2==0)
   return 0;
else
   return num1/num2;

}
int main()
{
  
   int result=Quotient(9,3);
   cout<<result;
  
   return 0;
  
}

**********************************************************************************

----------------------------------------------------------------------------------------------------

Output:-

I source code close shortcuts fullscreen #include iostream» 2 using namespace std; 3 void Max (int numl, int num2, int & ans)source code close shortcuts fullscreen #include <iostream> 2 using namespace std; 4 int Quotient (int num1, int num2) if (num>source code close shortcuts tullscreen #include iostream» 2 using namespace std; 3 int Sum(int 1, int m) return 1+m; 5 void

*******************************************************************************************************************

if you are satisfy with my answer then please ,please like it.

Add a comment
Know the answer?
Add Answer to:
KINDLY HELP SOLVE THE C++ SECURE SHELL DRILLS, RUN AND COMPILE THEM TO PERFORM THE TASK PERFECTLY...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • IV. Function Tracing (20 points) Trace the following program. Show llof your work and the ound...

    IV. Function Tracing (20 points) Trace the following program. Show llof your work and the ound he output in the work including labeled boxes for user-defined functions, calculations, and the output in designated spaces. You should draw a box for each variable and show value updates d the output, Show all of your #include <iostream» using namespace std; void mickey (int sa, int b, int &c) void minnie(int u, int &v, int w); void pluto (int m, int n, int...

  • Project Execute Tools AStyle Window Help 456 TDM-GCC 4.9.2 32-bit Profiling I"l practicel swapNums-KEY.cpp This progran uses a function to swop the values in two variables. 1 3 TO DO: 4 change th...

    Project Execute Tools AStyle Window Help 456 TDM-GCC 4.9.2 32-bit Profiling I"l practicel swapNums-KEY.cpp This progran uses a function to swop the values in two variables. 1 3 TO DO: 4 change the function swap Nuns to use two pointer parameters instead of two reference parameters, and 5 then modify the complete program accodingly <iostream > #include 8 9 using namespace std; 10 void swapNums (int&, int&) 12 int main() 13 14 15 int numl5, num2 = 7; 16 cout...

  • NEED ASAP PLEASE HELP Task: --------------------------------------------------------------------------------------...

    NEED ASAP PLEASE HELP Task: --------------------------------------------------------------------------------------------------------------------------------- Tasks to complete: ---------------------------------------------------------------------------------------------------------------------------------------- given code: ----------------------------------------------------------------------------------------------------------------------------------------------- main.cpp #include <iostream> #include <iomanip> #include "fractionType.h" using namespace std; int main() { fractionType num1(5, 6); fractionType num2; fractionType num3; cout << fixed; cout << showpoint; cout << setprecision(2); cout << "Num1 = " << num1 << endl; cout << "Num2 = " << num2 << endl; cout << "Enter the fraction in the form a / b: "; cin >> num2; cout << endl; cout <<...

  • Greetings, everybody I already started working in this program. I just need someone to help me...

    Greetings, everybody I already started working in this program. I just need someone to help me complete this part of the assignment (my program has 4 parts of code: main.cpp; Student.cpp; Student.h; StudentGrades.cpp; StudentGrades.h) Just Modify only the StudentGrades.h and StudentGrades.cpp files to correct all defect you will need to provide implementation for the copy constructor, assignment operator, and destructor for the StudentGrades class. Here are my files: (1) Main.cpp #include <iostream> #include <string> #include "StudentGrades.h" using namespace std; int...

  • C++ problem where should I do overflow part? in this code do not write a new...

    C++ problem where should I do overflow part? in this code do not write a new code for me please /////////////////// // this program read two number from the user // and display the sum of the number #include <iostream> #include <string> using namespace std; const int MAX_DIGITS = 10; //10 digits void input_number(char num[MAX_DIGITS]); void output_number(char num[MAX_DIGITS]); void add(char num1[MAX_DIGITS], char num2[MAX_DIGITS], char result[MAX_DIGITS], int &base); int main() { // declare the array = {'0'} char num1[MAX_DIGITS] ={'0'}; char...

  • language use : c++ Correct Tower application to move the disks from the pin on the...

    language use : c++ Correct Tower application to move the disks from the pin on the left to the pin on the right. Hint: draw the motion of th disks for a small set "say three" and walk your way through the recursion. #include <iostream> using namespace std; void towers(int,char,char,char); int main() int num; cout << "Number of disks: "; cin >> num; cout << "Sequences begin here \n"; towers(num, 'A', 'B! "C"); return 0; void towers(int num, char frompeg,...

  • Need help with a multiple inheritance work Question Compile and run the file. If you find...

    Need help with a multiple inheritance work Question Compile and run the file. If you find any compilation errors,explain their reason as comments in the code. Then fix the errors such that the program compiles and runs. Explain the motivation of your modifications in the code and their effects on the execution inheritance.cpp file #include<iostream> using namespace std; class A { int x; public: void setX(int i) {x = i;} void print() { cout << x; } }; class B:...

  • Help with C++ reverse program with leading zeros. I need to put the line from the...

    Help with C++ reverse program with leading zeros. I need to put the line from the function that display the zeros in main not in the function. So how can I move the display with leading zeros in main. Thanks. Here is my code. #include <iostream> #include <cstdlib> #include <iostream> using std::cout; using std::cin; using std::endl; //function templates int reverseNum(int); int main() { //variables char buf[100]; int num; while (true) { //prompt user for input cout << "Enter the number...

  • C++ 1. A?B?C?D? which one is correct 2. 3A, 3B #include<iostream> using namespace std; void swap0(int*...

    C++ 1. A?B?C?D? which one is correct 2. 3A, 3B #include<iostream> using namespace std; void swap0(int* ptri, int* ptr2) { int *temp; temp = ptr1; ptr1 = ptr2; ptr2 = temp; void swap1(int ptri, int ptr2){ int temp; temp = ptri; ptr1 = ptr2; ptr2 = temp; portion void swap2(int *&ptri, int *&ptr2){ int* temp; temp = ptr1; ptr1 = ptr2; ptr2 = temp; void swap3(int &ptri, int &ptr2) { int temp; temp = ptr1; ptr1 = ptr2; ptr2 =...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT