Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone,

I am a .net programmer and I face this small issue and hope you are able to help me with this it.

I am not good in c++ programming but I have had this problem and I need to solve it.

I need to write a program to draw the survey results.
The survey is about the online travel agencies usage.
The user will enter 5 if he always use the online service down to 1 that he never use the online service.

When the user finishes entering the survey, the program will print the survey results as shown on the following :

| 11
| * 10
| * *
| * 8 *
| * * *
| 6 * * *
| * * * *
| * * * *
| 3 * * * *
| * * * * *
| * * * * *
| * * * * *
|-----------------------------------------
1 2 3 4 5



So, can anybody help me with this because I am not familiar with c++

thank you so much!!!!
Posted
Updated 1-Dec-10 21:46pm
v3
Comments
Sandeep Mewara 2-Dec-10 1:57am    
If you are not a programmer, you don't know C++, who or why you need to do this? Assignment?
thatraja 2-Dec-10 2:13am    
Always give a meaningful description for Question title,"a small question ,please help" is really useless one.
Dalek Dave 2-Dec-10 3:47am    
Edited for Grammar, Syntax and Readability.

hi,

I'm not sure if I fully understand what you want to make, but maybe you'll find this reply useful anyway.
From what I understand, the vertical axis in your chart represents each question and the horizontal axis prints a number of *s equal to the rating the user gave as answer?
You have 12 lines so I'll assume 12 questions. Let's say the answers to the questions are stored in an array answer.

You'd read your answers like so:
int answer[12];
printf("Question 1: How often do you use this online service? [1-5]\n");
scanf("%d",&answer[0]);
printf("Question 2: How often do you use this other online service? [1-5]\n");
scanf("%d",&answer[1]);
// Do this for every question you want to ask


Now you print the results like so:
for(int i=0;i<12;i++){  // Loop through every question
    putchar('|');
    for(int j=0;j<answer[i];j++)>
        putchar('*');  // Print a number of *s equal to the rating
    putchar('\n');
}
printf("|-----------------------------------------\n1 2 3 4 5\n");


If the vertical axis doesn't mean questions but for example how many people voted a certain score [1-5], you can store these scores in a similar array and print the results much the same way as in this example.
 
Share this answer
 
v3
Comments
Dalek Dave 2-Dec-10 3:48am    
Excellent Answer!
hey people it's not assignment at all ,

I am asp.net developer and i use vb.net but the problem is that i never deal with c++:thumbsdown:. i just need the syntax that is all ,if you want the code in vb.net i can support you with it . :omg:
 
Share this answer
 
Comments
Dalek Dave 2-Dec-10 3:47am    
Fair call, that's how I read your original post.
Thank you so much Thaddeus Jones.

almost it's the right :)

i will try it now.

>Dalek Dave thank you for editing my subject , and really it was very hard task for me :(( to solve this one in c++.

here some people needs just to modify the old systems.

that is why i put this one here.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900