CFanatic

Go Back   CFanatic > Programming > C++ Programming

Join CFanatic Forum Now

C++ : need quick tips for easy histogram topic posted under C++ Programming which is a part of Programming category in CFanatic Forum
Reply
 
Thread Tools Display Modes
  #1  
Old 09-07-2007, 02:51 PM
Junior Member
 
Join Date: Sep 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
trapeze is on a distinguished road
| More
Unhappy C++ : need quick tips for easy histogram

i'm stuck with assignment...

i am trying to do easy histogram with x-axis info(like number options) and y-axis info(like # of occurrence) all within a figure by C++. however, i've no ideas to proceed at all.

i am thinking about the following data: x-axis values are 1,2, and 3. y-axis values are 3, 7, and 4 for each x value respectively.

i hope to hear you guys. great thx.
Reply With Quote
  #2  
Old 09-07-2007, 03:49 PM
Junior Member
 
Join Date: Sep 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
trapeze is on a distinguished road
| More
Re: C++ : need quick tips for easy histogram

if the above is too easy, please help me out w/ the folowing:

Code:
#include<iostream>
using namespace std;

int main()
{

int i;
int j;
int k;
int occurrence[10]={0,0,0,0,0,0,0,0,0,0};
int data[10]={6,14,82,42,46,32,97,44,27,68};
for (j=0; j<10; j++)
  { 
    for (i=0; i<10; i++)
        { 
          if ((data[j] >= 10*i) && (data[j] < 10*i+9)) 
             occurrence[i]++;
        }
  } 
cout << "occurrence # is ";
for (k=0; k<10; k++)
cout << occurrence[k]<<" "; 

}
----------------------------------------------------------
i don't know how to plot. i can't find the funtions. x-axis is 0-9,10-19,..,90-99. y-axis is the result above.

also, how can i generate zero array at once for occurrence w/o typing them out ?

great thx !

Last edited by shabbir; 09-07-2007 at 09:57 PM. Reason: Code block
Reply With Quote
  #3  
Old 09-07-2007, 09:58 PM
shabbir's Avatar
Administrator
 
Join Date: Sep 2006
Posts: 1,163
Thanks: 57
Thanked 63 Times in 44 Posts
shabbir has a spectacular aura aboutshabbir has a spectacular aura about
| More
Re: C++ : need quick tips for easy histogram

For plotting you need to be doing some graphics fucntions and can you tell what OS and compiler you are using.
Reply With Quote
  #4  
Old 09-07-2007, 11:21 PM
Junior Member
 
Join Date: Sep 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
trapeze is on a distinguished road
| More
Re: C++ : need quick tips for easy histogram

Quote:
Originally Posted by shabbir View Post
For plotting you need to be doing some graphics fucntions and can you tell what OS and compiler you are using.
THX !

WinXP 2.0
Dev-C++
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

 

Advertisement

CFanatic Search
Custom Search

Advertisement

All times are GMT -5. The time now is 02:39 AM.



Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO ©2010, Crawlability, Inc.
Cfanatic.com is a premier member of the IDG TechNetwork. For advertising opportunities contact here
Get Paid for Working on Projects Matching Your Expertise at Go4Expert's Jobs Board