Question

1) Create a flowchart for the program below and Trace the program below with input of...

1) Create a flowchart for the program below and Trace the program below with input of 3 and then again with input of 5.

#include <iostream>
using namespace std;
int Fall(int x, int m)
{ int Xm = 1, i=x;
while(i>=x-m+1)
{ Xm = Xm*i;
i=i-1;
}
return Xm;
}
int Delta(int x, int m)
{ int ans = 0;
ans = Fall(x+1,m);
ans = ans - Fall(x,m);
return ans;
}
void main()
{ int x = 0, m = 2, ans = 0, i=0, j=1;
cout<<"Enter a Number\n";
cin>>x;
cout<<" x \\ m |";
m=1;
while(m<x)
{ cout<<" "<<m;
m=m+1;
}
cout<<endl;
i=0;
while( i<=x)
{ cout<<"_____";
i=i+1;
}
cout<<endl;
j=1;
while(j<=x)
{ cout<<" "<<j<<" |";
m=1;
while( m<x)
{ ans = Delta(j,m);
cout<<" "<<ans;
m=m+1;
}
cout<<endl;
j=j+1;
}
}

Homework Answers

Answer #1

Answer: Here, is the flowchart for your problem.

OUTPUT for input x=3;

OUTPUT for input x=5;

Please let me know if still not clear. Hope you got your answer :)

Know the answer?
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
Similar Questions
Please write variables and program plan (pseudocode) of the C++ programming below: #include <iostream> #include <cmath>...
Please write variables and program plan (pseudocode) of the C++ programming below: #include <iostream> #include <cmath> using namespace std; void divisors(int num); int main () {    char repeat;    int num;       while (repeat !='n')    {        cout << "Enter a number: ";        cin >> num;        divisors(num);        cout << "Continue? (y or n): ";        cin >> repeat;    }    return 0; } void divisors(int num) {   ...
How to trace a c++ program by hand #include<iostream> using namespace std;    class Test {...
How to trace a c++ program by hand #include<iostream> using namespace std;    class Test {     int value; public:     Test(int v); };    Test::Test(int v) {     value = v; }    int main() {     Test t[100];     return 0; } _______________ #include <iostream> using namespace std; int main() { int i,j; for (i=1; i<=3; i++) { for(j=1; j<=i; j++ ) { cout<<"*"; } cout << "\n";   } return 0; }
C++ Please and thank you. I will upvote Read the following problem, and answer questions. #include<iostream>...
C++ Please and thank you. I will upvote Read the following problem, and answer questions. #include<iostream> using namespace std; void shownumbers(int, int); int main() { int x, y; cout << "Enter first number : "; cin >> x; cout << "Enter second number : "; cin >> y; shownumbers(x, y); return 0; } void shownumbers(int a, int b) { bool flag; for (int i = a + 1; i <= b; i++) { flag = false; for (int j =...
C++ PROGRAM When I input 3 S P R, it was suppoesed to pop up L...
C++ PROGRAM When I input 3 S P R, it was suppoesed to pop up L W T. But it showed L L L.IDK why the moveNo is not working. I am asking for help, plz dont put some random things on it. main.cpp #include <iostream> #include "computer.h" #include "human.h" #include "referee.h" using namespace std; int main() {     human h;     computer c;     referee r;     r.compare(h,c);     return 0; } computer.cpp #include<iostream> #include "computer.h" using namespace std;...
Please fill in the blank bolded below that would be the best choice for this program....
Please fill in the blank bolded below that would be the best choice for this program. #include <iostream> using namespace std; const int size = 100000; class TheBig { public: double operator[](int index) const {return (theData[index]);} private: double theData[size]; }; void firstToBeThe( ______________________________________________________) { for (int i = 0; i <size; i++) cout << value[i] <<endl; } int main() { TheBig one; firstToBeThe(one); }
Please write variables and program plan (pseudocode) of the C++ programming code below: #include <iostream> #include...
Please write variables and program plan (pseudocode) of the C++ programming code below: #include <iostream> #include <cmath> using namespace std; int getWeight(); float deliveryCharge(int weight); void displayCharge(int weight); int main () {    displayCharge(getWeight());    return 0; }   int getWeight() {    int weight;    cout << "Enter package weight (oz): ";    cin >> weight;    return weight; } float deliveryCharge(int weight) {    if (weight > 16)    {        return (((weight - 16) / 4) *...
How to stop the program from exiting after display detail. When there is food detail, it...
How to stop the program from exiting after display detail. When there is food detail, it will display and exit the program. What can i do to make it not exit the program and back to main menu. #include <iostream> #include <iomanip> #include<string.h> using namespace std; struct food{ int order_id; string food_code,flavor,customer_id; string address,name; int weight,unit_price,qty,contact_number; struct food *next; };    class Foodsystem{ food *head,*temp,*temp2,*end; static int id;    public: Foodsystem(){ head=NULL;end=NULL;} void Place_Order(); void View_food_details(); void Modify_food_details(); void Delete_food_details();...
No matter what I do I cannot get this code to compile. I am using Visual...
No matter what I do I cannot get this code to compile. I am using Visual Studio 2015. Please help me because I must be doing something wrong. Here is the code just get it to compile please. Please provide a screenshot of the compiled code because I keep getting responses with just code and it still has errors when I copy it into VS 2015: #include <iostream> #include <conio.h> #include <stdio.h> #include <vector> using namespace std; class addressbook {...
Implement the body of the swap function using the indirection operator // finish this program so...
Implement the body of the swap function using the indirection operator // finish this program so that the values of // x and y are swapped in main(). #include <iostream> using namespace std; void swap(int* first, int* second) { // IMPLEMENT THIS FUNCTION // YOUR CODE GOES HERE } int main() { int x = 9; int y = 2; swap(&x, &y); cout << "x: " << x << endl; cout << "y: " << y << endl; // if...
C++ PROGRAMMING Hi! I have to make a program that adds fractions and simplifies them. I...
C++ PROGRAMMING Hi! I have to make a program that adds fractions and simplifies them. I feel like I know how to write that. What I'm having trouble with is implementing two files the professer gave us. I would appreicate any help in understanding their purpose as in if Im supposed to take information from those files or give it information. Thank you! I have attatched the homework instructions and the two files given. Implementation The main program, called calculator.cpp...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT