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
4.Quit

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
2.20-40
3.40-60
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
  Copyright: 
  Author: Andrew Reid
  Date: 17/08/11 11:47
  Description: Survey
*/

#include<iostream>
#include<cstdlib>
#include<string>
#include<sstream>
#include<fstream>
#include <windows.h>
#include <iomanip>
#include<string>


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;
cout<<"-----------------------"<<endl;


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

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

                  
/*===========================================================================*/ 

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

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

            system("cls");
            out<<endl<<"Adventure Streak Survey"<<endl<<"--------------------"<<endl;
            cout<<"How long have you been a member of Adventure Streak (right in weeks):"<<endl;
            cin>>membershiplength;
            out<<endl<<"I have been a member for "<<membershiplength<<" weeks"<<endl<<endl;
            system("cls");
            
            do{
            cout<<"What hand to hand level are you (1,2,3): ";//What hand to hand level are you (switch operation)
            cin>>hthLevel;
            if(cin.fail()){ 
            cin.ignore(255);
            cout << "cin failed." << endl; 
            cin.clear(); 
            }
            
            else
            {
            switch(hthLevel){
                                    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)
            cin>>slackLevel;
            switch(slackLevel){
                                    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)
            cin>>parkLevel;
            switch(parkLevel){
                                    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;
                                    }
            
            
            
            
            system("cls");//Clear 
            
            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)
            cin>>country;
            switch(country){
                                    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;
                                    }
                                    
            system("cls");//Clear
                                    
            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;
            cin>>ageGroup;
            switch(ageGroup){
                                    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;
                                    }
                                    
            system("cls");//Clear
            
            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;
      




system("pause");
return 0;
}

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

Comments
we can't solve your questions like this

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!

This article has been dead for over six months. Start a new discussion instead.