I require a survey c++ program. The requirements are that it must do the following:

It must first the user what they would like to do:

1.Complete the survey and writing it to a file, averaging some results and then quiting
2.Read the survey results from the files (password protected)
3.Print the Survey

If completing the survey for the company it must first ask for their membership length in weeks and failing if the input is incorrect and relooping (It does not have to write this to file). The next stepis it must ask for:

1.Their Hand to Hand level (1,2,3) It must count this every time the survey is completed
2.Their Slacklining level (1,2,3) It must count this every time the survey is completed
3.Their Parkour level (1,2,3) It must count this every time the survey is completed

These must fail and reloop if an incorrect input is entered. The results must be written to the file and these results must be averaged for each individual level.

The user must the be asked their country of origin out of 4 random countries (this does not have to be written to the file)

Then the user must be asked for their age group
1.Under 20
4.60 over
these groups must be individually counted and written to the file and averaged.

It must then ask the user what they liked about the company and write this to a separate file

It must then ask the user what needs to be improved with the company and write this to a separtae file again

It must then quit.

If some one could write this code for me it would be very much aprieciated as i dont really know how

This is what i have so far:

  Name: Adventure Streak Company Survey
  Author: Andrew Reid
  Date: 17/08/11 11:47
  Description: Survey

#include <windows.h>
#include <iomanip>

using namespace std;

int main(){

int membershiplength;
char input;
int hthLevel, slackLevel, parkLevel, country, ageGroup;
int loop(1);
string input1[1000];

cout<<"Adventure Streak Survey"<<endl;

/*============================= Menu Selection =============================*/ 

cout<<endl<<"1.Complete Survey"<<endl;
cout<<"2.Read the Survey"<<endl;
cout<<"3.Print the Survey"<<endl;
cout<<endl<< "Make a selction form the list above by picking a number: "<<endl;


/*============================= Survey =============================*/ 

ofstream out ("AdventureStreakSurvey.txt", ios::app);

            out<<endl<<"Adventure Streak Survey"<<endl<<"--------------------"<<endl;
            cout<<"How long have you been a member of Adventure Streak (right in weeks):"<<endl;
            out<<endl<<"I have been a member for "<<membershiplength<<" weeks"<<endl<<endl;
            cout<<"What hand to hand level are you (1,2,3): ";//What hand to hand level are you (switch operation)
            cout << "cin failed." << endl; 
                                    case 1:out<<"Hand to hand level= 1"<<endl;break;
                                    case 2:out<<"Hand to hand level= 2"<<endl;break;
                                    case 3:out<<"Hand to hand level= 3"<<endl;break;
                                    default: cout<<endl<<"Incorrect";break;
            }while((hthLevel == 1)||(hthLevel == 2)||(hthLevel == 3)); 
            cout<<"What slacklining are you (1,2,3): ";//What slacklining level are you (switch operation)
                                    case 1:out<<"Slacklining level= 1"<<endl;break;
                                    case 2:out<<"Slacklining level= 2"<<endl;break;
                                    case 3:out<<"Slacklining level= 3"<<endl;break;
                                    default: cout<<endl<<"Incorrect";break;
            cout<<"What parkour are you (1,2,3): ";//What parkour level you are (switch operation)
                                    case 1:out<<"Parkour level= 1"<<endl;break;
                                    case 2:out<<"Parkour level= 2"<<endl;break;
                                    case 3:out<<"Parkour level= 3"<<endl;break;
                                    default: cout<<endl<<"Incorrect";break;
            cout<<"Where is your country of origin (enter the number): "<<endl;
            cout<<"1.New Zealand"<<endl<<"2.Australia"<<endl<<"3.United States of America"<<endl<<"4.England"<<endl;//What country are you from (switch operation)
                                    case 1:out<<endl<<"My country of orgin is New Zeland"<<endl;break;
                                    case 2:out<<endl<<"My country of origin is Australia"<<endl;break;
                                    case 3:out<<endl<<"My country of origin is the United States of America"<<endl;break;
                                    case 4:out<<endl<<"My country of origin is England"<<endl;break;
                                    default: cout<<endl<<"Incorrect";break;
            cout<<"What age gropup do you belong to are you: "<<endl; //What age group do you belong to (switch operation)
            cout<<"1. Under 20"<<endl<<"2.Between 20-40"<<endl<<"3.Between 40-60"<<endl<<"4.Over 60"<<endl;
                                    case 1:out<<endl<<"I am under 20 years of age"<<endl;break;
                                    case 2:out<<endl<<"My age is in between 20 and 40"<<endl;break;
                                    case 3:out<<endl<<"My age is in between 40 and 60"<<endl;break;
                                    case 4:out<<endl<<"I am over 60 years of age"<<endl;break;
                                    default: cout<<endl<<"Incorrect";break;
            cout<<"Please write a short paragraph below about what you liked about Adventure Streak"<<endl;//Paragraph about what they like about adventure streak
            cout<<"Please write a short paragraph below about what you think needs to be improved about Adventure Streak"<<endl;

return 0;

Recommended Answers

All 3 Replies

Ah! and what is the question now?

Would you please be able to create this for me as my code i have written is bad and incomplete

commented: we can't solve your questions like this -1

I assume you have not yet studied OOP, I will say break down each part of problem into functions and in main just play around with functions depending one menu choice. Menu can be simple switch in while loop
Try to formulate this as it will give you much cleaner code and reuse your functions
I will be happy to help after you start that!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.