3,815 Topics

Member Avatar for
Member Avatar for MjLaali

Is there any way to pass a class as a function pointer. for example: [code=C++] int compare(int a, int b) { return a - b; } void sort(int *ar, int (*pf)(int, int)) { //a sorting algorithm. } class MyClass { bool condition; public: int compare(int a, int b) { if …

Member Avatar for bugmenot
1
136
Member Avatar for TuX4020

Hi all, this is my first post here and it comes out of frustration more than anything. I've been searching high and low for any insight into my problem and still can't seem to get it right. In the interest of full disclosure, this is a part of a homework …

Member Avatar for TuX4020
0
3K
Member Avatar for bojanski

Hello everyone. First, i'd like to introduce myself, would be very rude to just jump in here :) I'm Bojan, student, 1. year, Croatia, and in this semester i've got a class "Programming 1". Here we're doing C++ (in Visual C++). And the idea of the class is to make …

Member Avatar for bojanski
0
128
Member Avatar for MRafeie

Dear All I'm looking for an algorithm or method to divide a GraphicsPath into some segments. For example: There is a curve and I'd like to have 10 points on it which denote to 9 section with equal length. i.e.GraphicsPath is a class in 'System.Drawing.Drawing2D' namespace.

Member Avatar for MRafeie
0
56
Member Avatar for tohamy

please, i want application for map coloring using csp algorithm this application include four color to colored 6 lables by csp algorithm

0
50
Member Avatar for Xelalem

I 'm new to this website and c# ,but iam good at c++ and vb 6.0 .i really need someone tohelp me on this i just need the algorithm or anything to help me start . any one plz...

1
41
Member Avatar for demroth

I am currently working on a project in which I need real-world datasets to use with the Bellman-Ford algorithm. I would like directed or undirected graphs related to routing to use but havent been able to find any. Does anyone know where I could find such materials?

0
63
Member Avatar for nurulshidanoni

what is the =' : left operand must be l-value means? error C2106: '=' : left operand must be l-value [code=C++] #include <iostream> // std::cout #include <fstream> #include <iomanip> #include <string> // std::string #include <vector> // std::vector<> #include <algorithm> //std::for each() using namespace std; // import "std" namespace into global …

Member Avatar for nurulshidanoni
0
437
Member Avatar for nurulshidanoni

Can anybody help me whis this error? in red colour... error C2109: subscript requires array or pointer type error C2109: subscript requires array or pointer type : error C2109: subscript requires array or pointer type error C2664: 'void __cdecl std::swap(int &,int &)' : cannot convert parameter 1 from 'int' to …

Member Avatar for Agni
0
958
Member Avatar for rukshenaa

implementing dijkstra algorithm using fibonacci heap and linked list........... can anybody help me with the coding for this problem.................. i hav implemented using array now i hav to implement it using fibonacci heap and linked list.............

Member Avatar for rukshenaa
0
119
Member Avatar for Skeezo

Hello when I try to compile my program I get these errors: 1>funding6c.obj : error LNK2019: unresolved external symbol "void __cdecl ContributorSort(struct Contribution * const,int &)" (?ContributorSort@@YAXQAUContribution@@AAH@Z) referenced in function _main 1>C:\Users\Big Z\Desktop\program 6\Debug\program 6.exe : fatal error LNK1120: 1 unresolved externals what could be causing this? [code=C++] #include <iostream> …

Member Avatar for Skeezo
0
426
Member Avatar for sjcomp

Hello, I'd like to split a string into smaller parts using delimiters that are longer than one character. I'm curious if boost::algorithm::split can be used for that. I can not figure out what predicate I should give it to compare strings [CODE=C++] #include <vector> #include <string> #include <boost/algorithm/string/split.hpp> std::vector< std::string …

Member Avatar for sjcomp
0
5K
Member Avatar for nurulshidanoni

I have this programming but I want to sort the total in descending order... How to make an examid together with total after has sort the output? [code=C++] #include <iostream> // std::cout #include <fstream> #include <iomanip> #include <string> // std::string #include <vector> // std::vector<> #include <algorithm> //std::for each() using namespace …

0
60
Member Avatar for chemicaldave

I'm being given the assignment of using the selection sort method to alphabetize a 2D array of names. Specifically I am supposed to modify a selection sort algorithm for integers and convert it for my purposes. I took the skeleton code and tried to convert it. The program compiles and …

Member Avatar for chemicaldave
0
141
Member Avatar for lianaconda

What's the best way to swap two arrays? Would it be better to copy each position into a new array and then assign the array a new name? Or would it be better to use pointers? What would the algorithm be if I were to use pointers or a dynamically …

Member Avatar for dougy83
0
117
Member Avatar for hostintruder

Hello friends , I got an important coursework to submit . Let me explain, the coursework consist of a file .. which we must sort, search and we must event create a y-sort algorithm. After much struggle, i was able to use the stringtokensier to input the data from the …

Member Avatar for hostintruder
0
109
Member Avatar for xRuP7uR3x

Greetings everyone. I have been working on a script to convert a number from any base to any base up to base62. The user supplies the original number, the starting base, and the end base. My problem arises when converting the fractional part from base10 to the end base; the …

Member Avatar for jrcagle
0
156
Member Avatar for debee

Hi there, Can someone figure out why I am getting this problem, please. In my algorithm, i have this method that takes in a BigDecimal value and returns a BigDecimal value as shown below: [code] public BigDecimal sigmoidActivationFunction(BigDecimal sum) { Big_pi test2 = new Big_pi(); //sum = sum.multiply(new BigDecimal(-1.0)); BigDecimal …

0
53
Member Avatar for WilliamBaxter

I have done this based on the other post ....... all I need is too arrange the words entered first the biggest word , then the smallest word and then the remaining word please do tell me what ad to this [code=cplusplus] #include <iostream> #include <vector> #include <string> #include <algorithm> …

Member Avatar for Ancient Dragon
-1
130
Member Avatar for rok92

Hi Guys, So I am trying to use C++ and openGL to create a simple robot arm that will follow a traget on the screen. I am to use Inverse Kinematics and more specifically the Cyclic Coordinate Descent Algorithm. I have found a few different ways to implement this although …

0
49
Member Avatar for veronicak5678

I am trying to write two programs to work in conjunction. The first is a bibliography program that writes book info to a file; That's ok. Here's what I did: [CODE]#include <string> #include <fstream> #include <vector> #include <iomanip> #include <sstream> #include <iostream> #include <iterator> #include <vector> // vector class-template definition#include …

Member Avatar for veronicak5678
0
150
Member Avatar for mnv29brt

//To check if there is a win #include <iostream> #include "tictactoe.h" using namespace std; int win(char board[3][3]) { for(int i=0;i<3;i=i+1) { if ((board[0] == 'x' && board[1] == 'x' && board[2] == 'x')|| (board[0] == 'o' && board[1] == 'o'&& board [2]== 'o')) return 1; else if((board[0] == 'x' && …

Member Avatar for mnv29brt
0
125
Member Avatar for drichird

It's tough being 50 and back in college! If anyone has recently taken an Algorithm class, my question is this: Is the proof for Prim's algorithm any different than for Kruskal? I understand both algorithms are greedy in the sense of picking the least weight edge each itiration. Prims only …

Member Avatar for sarehu
1
456
Member Avatar for SamLeach

I need help coding the following pseudo code into C#. The 3 algorithms are search methods for a program which can look through a set of data to find the subsequence of values which add up to the highest total value. So for example with the data set. 10 -6 …

0
38
Member Avatar for skatamatic

I've recently made a pi calculator out of a pretty rediculous algorithm (which is incredible accurate by the way). Unfortunately, C++ doubles can only hold 16 digits of it! I know that's plenty enough for any practical applications, but I want more accuracy! (Call me insane). I'm just looking for …

Member Avatar for skatamatic
0
147
Member Avatar for El Duke

Hello Everyone, I am not that expert in coding, just coding on a level that helps me to implement some wireless modules /packets/ links/ etc.... I was wondering if we could implement AI search algorithms using C code, as an example, in this image: [IMG]http://planning.cs.uiuc.edu/img338.gif[/IMG] It is the Bidirectional search …

Member Avatar for El Duke
0
99
Member Avatar for renabada

1. (a) A positive whole number n > 2 is prime if no number between 2 and (inclusive) evenly divides n. Write a program that accepts a value of n as input and determines if the value is prime. If n is not prime, your program should quit as soon …

Member Avatar for Paul.Esson
0
371
Member Avatar for nurulshidanoni

I have this data..but something error..my data is like this... Exam TExam 1 25 2 20 3 46 4 56 5 12 but it only appear like this 1: -853617 [code=C++] #include <iostream> // std::cout #include <fstream> #include <iomanip> #include <string> // std::string #include <vector> // std::vector<> #include <algorithm> //std::for …

Member Avatar for nurulshidanoni
0
112
Member Avatar for nurulshidanoni

If I want to sort in descending order for exams.at (i).total.at(j) like this.. the output 1 34 2 56 3 21 and I want to cout the output 2 56 1 34 3 21 Is it must to use bubble sort or radix sort? [code=c++] #include <iostream> // std::cout #include …

Member Avatar for mitrmkar
0
612
Member Avatar for xRuP7uR3x

Hello again. Before I begin I would like to offer my heartfelt gratitude to the DaniWeb community; this website truly is a wonderful resource for a new programmer such as myself, and the help and advice that I have received have been incredibly useful. I am currently working on a …

Member Avatar for dabear
0
78
Member Avatar for nurulshidanoni

AYBODY KNOWS WHY THIS PROGRAM IS ABNORMAL? [code=C++] #include <iostream> // std::cout #include <fstream> #include <iomanip> #include <string> // std::string #include <vector> // std::vector<> #include <algorithm> //std::for each() using namespace std; // import "std" namespace into global namespace struct exam { string examid; vector <int> total; }; int myfile; int …

Member Avatar for Ancient Dragon
0
119
Member Avatar for Trckst3

Hey guys i'm still having trouble with my bubble sort in else if(choice==2). Where am i going wrong i'm about ready to pull my hair out #include <iostream> #include <iomanip> #include <algorithm> using namespace std; int main() { int i,num[20],n,j,choice,tmp; cout<< "Please enter 20 integers"; for (i=0; i<20; i++) { …

Member Avatar for Sky Diploma
0
118
Member Avatar for rockmania

I need C code or program to save the output of the following program into a jpg file(any picture file)? i need to save the output of this program in to a picture file..i need to take printouts of those output..help me with the code that does the above thing... …

Member Avatar for Salem
0
151
Member Avatar for Trckst3

Hey I'm trying to get this code going but i can't get my if(choice==2) to output anything any ideas? #include <iostream> #include <iomanip> #include <algorithm> using namespace std; int main() { int i,num[20],n,j,choice,tmp; cout<< "Please enter 20 integers"; for (i=0; i<20; i++) { cout<<"\nEnter next value:"; cin>>num[i]; } cout<<"\n1.Display original …

Member Avatar for Trckst3
0
81
Member Avatar for Trckst3

Hi guys I'm new here and basically new to programming. Unfortuanetly i'm probably gonna be quite annoying to you just because you guys know what you're doing and I'm like the little slow train that's trying to catch up. Though hopefully you'll help... Here's my situation I'm supposed to write …

Member Avatar for ivailosp
0
100
Member Avatar for cute121180

Problem statement: The program has to take input for DFA and for h() function that is for homomorphism. I am able to write the program in C++ only for DFA. I am unable to include the h() function. Moreover, my DFA program giving me an error. [code=cplusplus] #include <iostream> #include …

Member Avatar for cute121180
0
191
Member Avatar for obsolucity

I am having trouble with this assignment and was hoping I could get some help. I am not sure whether or not the output for my decomposed, unsorted, and sorted lists are correct. I'm not sure how to interpret the data in order to help justify why the big-o estimate …

Member Avatar for Laiq Ahmed
0
320
Member Avatar for vaid.abhishek

Okay, guys, after running a thread bout tht nth_element problem [ which is still not solved ] I again have a problem. The code I give below [ I have also attached the file ], is simply a MergeSort procedure. It works wonderfully well. I have enabled validation of it …

Member Avatar for vaid.abhishek
0
140
Member Avatar for wubeikk

Assignment #1 First Class – extended version 1. Extend the class myTime from the previous assignment so it includes methods of all types (excluding operators) discussed during the lecture. The constructors and the destructor should print out a notifying message on the screen. 2. Write a function with the copyMe …

Member Avatar for wubeikk
0
184
Member Avatar for vaid.abhishek

Hi, Guys Here's an important problem I have been facing lately. My idea is to partition an array on basis of an element such that, this element has all the elements smaller than it before it and all the elements greater than it after it ... ( Similar to pivoting …

Member Avatar for Ancient Dragon
0
296
Member Avatar for rukshenaa

i have to implement dijikstra algorithm using fibonacci heap............. i dint get any soltion for this problem............. :'( :'( :'( can anybody help me.....................:(

Member Avatar for jbennet
0
97
Member Avatar for Noliving

Here is the problem: Does the recursive algorithm for raising x to the power n work for negative values of n? Does it work for negative values of x? Indicate what happens if it is called for each of these cases. Here is my answer for the above: It's a …

Member Avatar for Noliving
0
240
Member Avatar for Jx_Man

Hi all... I m working for my graduated project. and my method in using is Genetic K-means Algorithm. i m using vb.net 2003 and sql server 2000. Does Anyone know a sample code for this?or a website / link for this topic??? please help me... any reply really appreciated... Thx.Best …

Member Avatar for Jx_Man
2
165
Member Avatar for Virginie

Hi everyone, I'm trying to implement the Kruskal algorith in Java, I understand the algorithm completely but encounter some difficulties in implementing it, and believe me I have tried to read about it. I would like to define a new class of elements that can define the graph, a bit …

Member Avatar for javaAddict
0
76
Member Avatar for dallaseve

[QUOTE]Hi, I have an assignment where I need to take a string and display it in reverse order and then convert anything in upper case to lower case and vis versa. I have the first piece of the code, but I'm not sure where to begin with the second piece. …

Member Avatar for dallaseve
0
105
Member Avatar for random7

this is some of code. I have a question. what is the meaning of '?' and ':1;' [just this part] [code=syntax] int t, dt, * cnt, tmax=0; cnt=(int*)calloc(M,sizeof(int)); ... /* Compute the mean-squared displacement using the straightforward algorithm */ fprintf(stderr,"# computing...\n");fflush(stderr); for (t=0;t<M;t++) { for (dt=1;(t+dt)<tmax;dt++) { cnt[dt]++; /* number …

Member Avatar for William Hemsworth
0
194
Member Avatar for infernojmd

my output keeps putting out monday for everything need help with this, kinda confused on what im dooing [CODE]#include <iostream> #include <iomanip> using namespace std; void displayTitle(); int getMonth(int month); int getDay(int day); int getYear(int year); int CalcDayofWeek(int month, int day, int year); void displayDay(int G); int main() { //declare …

Member Avatar for vmanes
0
97
Member Avatar for infernojmd

fatal error C1075: end of file found before the left brace '{' at '.\project4.cpp(75)' was matched i am getting an fatal error and dont understand how to fix it, most help is appreciated [CODE] #include <iostream> #include <iomanip> using namespace std; void displayTitle(); int getMonth(int month); int getDay(int day); int …

Member Avatar for sarehu
0
91
Member Avatar for evank

I have a collection of (potentially) several hundred thousand image files that I need to generate hash digests for, and I'm unsure of the best algorithm to use. I'll be keying them all to a database based on their hash, so I need the best algorithm for avoiding accidental collisions …

Member Avatar for sarehu
0
281
Member Avatar for coolbreeze

I am having trouble figuring this out. I only have one error and it is in main. I am trying to write a program that will output first just a random sudoku type grid(function called random), then I am trying to output a sudoku type grid that has no duplicates …

Member Avatar for Ancient Dragon
0
80

The End.