c++ My max is 5$
C++ Menu
Please someone help me my professor want a menu and told us to answer the question sepetaly than add them to the menu i been trying to add the answer to one of the question in menu but it do not work anyone can help please code //System Libraries #include <iostream> using namespace std; //User Libraries //Global Constants - Math/Physics Constants, Conversions, // 2-D Array Dimensions //Function Prototypes void menu(); void prblm1(); void prblm2(); void prblm3(); void prblm4(); //Execution Begins Here int main(int argc, char** argv) { //Declare Variables char choice; //Loop and Display menu do{ menu(); cin>>choice; //Process/Map inputs to outputs switch(choice){ case '1':{prblm1();break;} case '2':{prblm2();break;} case '3':{prblm3();break;} case '4':{prblm4();break;} default: cout<<"Exiting Menu"<<endl; } }while(choice>='1'&&choice<='4'); //Exit stage right! return 0; } void menu(){ //Display menu cout<<endl<<"Choose from the following Menu"<<endl; cout<<"Type 1 for Independent-If example"<<endl; cout<<"Type 2 for Dependent-If example"<<endl; cout<<"Type 3 for Ternary Op example"<<endl; cout<<"Type 4 for Switch-Case example"<<endl<<endl; } void prblm1(){ //method to find all prime factors Primes *factor(int n) { int k=2; int m[10000]={0};//initially to store prime factors while(1<n) { if(n%k==0) { m[k]++;//finding prime factor n=n/k; } else k++; // cout<<k<<" "<<n<<endl; } //after finding prime factors int i=0; k=0; while(i<10000) { if(m[i]!=0)k++; i++; } Primes *p = new Primes; p->nPrimes=k; p->prime = new Prime[k];//creating prime array i=0; k=0; while(i<10000) { if(m[i]!=0) { p->prime[k].prime = i; p->prime[k].power = m[i]; k++; } i++; } return p;//returning primes structure } //method to print primes void prnt(Primes *p) {
8 years ago 5
Purchase the answer to view it
- menu.cpp
- Final Research Project Preparation – Annotated Bibliography
- 500 word discussion on alcohol
- MKT 421 Week 4 Learning Team Assignment Marketing Plan Phase III
- POS 355 Week 2 DQs
- IP 1 LOGISTIC
- Accounting Test
- Can someone do a Criminal Justice Trends Evaluation(law enforcement)?
- PSY 435 Week 3 Team Assignment Employee Selection and Training Paper
- delegations
- Assignment 1: Statistical Analysis ProjectDue Week 10 and worth 140 pointsFor this project, you need to create your own research...