Square, Algebra, Numerical, Analogy, Area, the following structures must be evident in your program

Question  

Please help me to make a program for this.

create program that has the following requirements:

menu driven program that has at least 6 options (6th option is for exit)

pick a problem from the following categories:

Algebra

Trigonometry

Analogy

Advanced Math

Numerical

Electronics

Physics

Circuits

Calculus

Statistics

The following structures must be evident in your program

Conditional structure

Looping structure

Array

Programmer Defined Functions

2.)ALL PROCESSES WHICH INVOLVE COMPUTATION MUST BE A PROGRAMMER-DEFINED FUNCTION

3.) No need to create Header file.

4.)For option EXIT; show your complete name, course code, and official time before terminating the program

5.)Show a pen and paper solution of the selected problem (Show solution)

 

 

Summary

It is implemented according to the given question which is in the menu bar chosen has 6 options. Now, that we have to insert 5 options in the menu bar which are algebra, mean, median, solve linear, analogy, square whereas the last option is the exit option.

Explanation

The menu bar is implemented with 5 options in the code. The first one is implemented Sum to find the sum of the array in the list of elements. The elements in the array are entered by the user and the loop will start to run. Now it is ready to print the sum of the array of elements in the list to traverse them. The next one is implemented by solving linear with the coefficients of ‘c’ and ‘d’ written by the user to run the loop statement of the list to console the statements in it and printed the output.

 

Now, the next method means is implemented to find the mean of given numbers in the array list of elements by the user then it gives the output of the following given. Next, the median is implemented to find the n numbers in the array list of given elements by the user then it gives the output of the following given.

 

Next, the area is implemented which is asked by the user to give the square of the element then, it prints the output for the given elements in the following.

Code

#include <iostream>
using namespace std;
void sum(){
    cout<<"Enter 5 numbers:\n";
    int arr[5];
    for(int p=0;p<5;p++)
    cin>>arr[p];
    int sum=0;
    for(int q=0;q<5;q++)
    sum+=arr[q];
    cout<<"Sum of n numbers = "<<sum<<endl<<endl;
}
void solveLinear(){
    int c,d;
    cout<<"Enter c and d: ";
    cin>>c>>d;
    cout<<"The value of x = "<<(-1*d)/c<<endl<<endl;
}
void mean(){
    int x,y,z;
    cout<<"Enter three numbers: ";
    cin>>x>>y>>z;
    cout<<"Mean = "<<(x+y+z)/3.0<<endl<<endl;
}
void median(){
    int r;
    cout<<"Enter r: ";
    cin>>r;
    cout<<"Enter r numbers:\n";
    int arr[r];
    for(int p=0;p<r;p++)
    cin>>arr[p];
    if(r%2==1)
    cout<<"Median = "<<arr[r/2]<<endl<<endl;
    else 
    cout<<"Median = "<<((arr[r/2]+arr[(r/2)+1])/2.0)<<endl<<endl;
}
void area(){
    int q;
    cout<<"Enter the side of a square: ";
    cin>>q;
    cout<<"Area of square = "<<q*q<<endl<<endl;
}
int main()
{
    cout<<"MENU\n1) Sum of n numbers\n2) Solve cx+d:\n";
    cout<<"3) Find mean\n4) Find median\n5) Find area of square\n6) exit"<<endl;
    int numbers;
    while(true){
        cout<<"Enter your numbers: ";
        cin>>numbers;
        if(numbers==6)
        break;
        else 
        {
            switch(numbers){
                case 1:
                sum();
                break;
                case 2:
                solveLinear();
                break;
                case 3:
                mean();
                break;
                case 4:
                median();
                break;
                case 5:
                area();
                break;
            }
        }
    }
}

Output

Square Algebra Numerical Analogy

 

Also, the read another blog which is to write a relational schema for the diagram.

 

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *