Thread: Can I make a plot?

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    204

    Can I make a plot?

    Let's say I've got the following function. It outputs an array that represents a sine wave for two periods. Is there a way I can ouput it to my screen so that it makes graph? I've used GNUplot but I was wondering if there was a way I could do it dirrectly in C++. Could this also be done in C?
    Code:
    #include <iostream>
    #include <math.h>
    
    using namespace std;
    
    int main()
    {
    double y[200];
    int i;
    
    for (i=0; i<200; i++)
    y[i]=sin(2*M_PI*(i)/100);
     
    for (i=0; i<200; i++)
    cout<< y[i]<<endl;
    
    return 0;
    }

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    There are no C or C++ standard functions that will do that. You have to use operating-specific functions or a cross-platform library such as wxWindows, QT, or the GNU drawing package you already use.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to make a Packet sniffer/filter?
    By shown in forum C++ Programming
    Replies: 2
    Last Post: 02-22-2009, 09:51 PM
  2. "Cannot make pipe"
    By crepincdotcom in forum C Programming
    Replies: 5
    Last Post: 08-16-2004, 12:43 PM
  3. HELP!wanting to make full screen game windowed
    By rented in forum Game Programming
    Replies: 3
    Last Post: 06-11-2004, 04:19 AM
  4. make all rule
    By duffy in forum C Programming
    Replies: 9
    Last Post: 09-11-2003, 01:05 PM
  5. Replies: 6
    Last Post: 04-20-2002, 06:35 PM