User Profile

Collapse

Profile Sidebar

Collapse
9966
9966
Last Activity: Nov 22 '07, 11:24 AM
Joined: Sep 30 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • implementing several searches on my code (Brute force, random and heuristic)

    Well previously I've asked a lot of question regarding Travelling Salesman Problem and I got a lot of helpful feedback from here. Thanks again for helping me.

    Now I've completed the full code. Basically I'm implementing several searches on my code (Brute force, random search and heuristic search). So now I've to do some literature review on other searches that can also be implemented to solve this problem. Well, I'm not experienced...
    See more | Go to post

  • 9966
    replied to koolplot in C++
    in C
    Can someone kindly give me some guidance please?
    See more | Go to post

    Leave a comment:


  • 9966
    started a topic koolplot in C++
    in C

    koolplot in C++

    Greetings, I'm currently dealing with koolplot and here is my problem. I need to generate a graph which consist of 2 data, X-axis would be fixed, whereby it will range from -1 to 101. As for Y-axis, it will have the data stored inside the arrays. Now I need to plot one line showing the data of array and another line showing data of array1. The following is my current code but it can't generate a graph. It does not have any compilation error and I'm...
    See more | Go to post

  • 9966
    replied to Plotting Graph in C++
    in C
    The following is my code..

    [PHP]#include <koolplot.h>
    using namespace std;

    int main()
    {
    double array[100];
    int numberToInsert = 99;

    for(int i=0; i<100.0; i++)
    {
    array[i] = i+1;
    }

    plotdata x(-20, 110),
    y(array, numberToInsert) ;
    plot(x,y);


    return 0;
    }[/PHP]

    ...
    See more | Go to post

    Leave a comment:


  • 9966
    replied to Plotting Graph in C++
    in C
    Another question is do I have to put in the equation in order to plot the graph? What if I've an array storing all the data, can I plot the graph using that array?
    See more | Go to post

    Leave a comment:


  • 9966
    started a topic Plotting Graph in C++
    in C

    Plotting Graph in C++

    Greetings, I'm currently having problem in plotting a simple graph in C++. I learned that we can actually use koolplot to do it. My question is whether it is possible to plot, let's say the performance of 6 algorithms into one graph? If so, how? Because when I refer to the koolplot documentation all I see is just plotting one thing at a time in a graph.

    Thanks for any advice given.
    See more | Go to post

  • 9966
    replied to Convert String to char
    in C
    I see.. okay I'll try to implement it onto my code. Thanks a lot
    See more | Go to post

    Leave a comment:


  • 9966
    replied to Convert String to char
    in C
    hmm... yes actually that's what I want. Because initially I've stored all the fruit's name into a string array and it's used by other function. And somewhere down the whole code, I need to compare character by character of the fruit's name. For example:

    1. P A P A Y A
    2. P E A C H

    I need to compare "P" with "P", since it's the same, then I've to proceed on the second alphabet which is "A"...
    See more | Go to post

    Leave a comment:


  • 9966
    started a topic Convert String to char
    in C

    Convert String to char

    Hi, currently I'm having a problem on converting a string type array into a char type. An example is as follows:

    string fruits[20];
    vector <char> temp;

    The fruits array HAS to be a string type and temp vector HAS to be a char type. This can't be changed. So I've a problem on storing the element of fruits array into temp vector as follows:

    temp.push_back( fruits[0]); <-----I know this is...
    See more | Go to post

  • 9966
    started a topic Vector with char type
    in C

    Vector with char type

    I'm currently having a confusion with storing characters into a vector. The problem is described as follows:

    I've a string array which stores, let's say the names of the vegetables.

    string vegeName[20];

    and this array is stored fully with all the names. Then I need to store one of the element in this string array into a vector. The project itself is asking us to do so, so I've no choice. So this is what...
    See more | Go to post

  • 9966
    replied to Generating random numbers
    in C
    I'm actually solving a TSP problem whereby I need to write a function to search the possible randomly. So I need to generate random numbers to help me choose which paths should I take in case there are more than 1 path. My current program is very very long already, so I don't know which snippet should I post it here. But anyway, thanks a lot for your advice. I think I've made some mistake in vectors due to random numbers. Because I'm using a lot...
    See more | Go to post

    Leave a comment:


  • 9966
    replied to Generating random numbers
    in C
    Or am I doing the wrong thing? without that line, rand() itself will generate numbers between 0~1 right? Because:

    tempNUM = rand();
    cout << "Random number generated is :" << tempNUM << endl;

    and all I see is the same (for e.g) 0.41.


    What will happen if I add srand((unsigned )time(0)), will the numbers being generated more than 1?
    See more | Go to post

    Leave a comment:


  • 9966
    replied to Generating random numbers
    in C
    No, it's not a compilation error. Well, before I add on that line, the program can run properly. But after I add on that line, the result shown on the command prompt is like an endless loop whereby the numbers are jumping non-stop.

    Since after adding that line will make the numbers generated randomly, but I'm still setting a proper range for the numbers generated in order to get the range that I want. I can't understand why this line...
    See more | Go to post

    Leave a comment:


  • 9966
    replied to Generating random numbers
    in C
    Yes I understand that the range can be obtained as follows to get numbers between 1~3:

    int randNum;
    randNum = (rand()%3)+1;

    But the problem I faced right now is, let's say I've add on a cout as follows:

    cout << "Number generated: " << rand() << endl;

    Let's give an example, when I run the program for the first time, the result is:

    Number generated:...
    See more | Go to post

    Leave a comment:


  • 9966
    started a topic Generating random numbers
    in C

    Generating random numbers

    Greetings,

    This is my second post till now. Thanks for all the advice given to me for the first post.

    Now I'm having problem with generating random numbers. I know if we want to generate a random number, we can use:

    int tempNUM = rand();

    But, once I execute the program, the generated number is always similar, and I found this from the internet. It says need to add this line to make the...
    See more | Go to post

  • 9966
    started a topic Vector Problem
    in C

    Vector Problem

    Greetings,

    I'm currently facing a problem on how to compare 2 vector's elements. For example, assuming we have declared 2 integer type vectors:

    vector <int> v1;
    vector <int> v2;

    and both vectors have some integer values stored inside. What is the syntax that I can use to check such that all the elements in v1 and v2 are the same? Can I do the following? Do I need to declare something...
    See more | Go to post
No activity results to display
Show More
Working...