3,815 Topics
![]() | |
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 … | |
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 … | |
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 … | |
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. | |
please, i want application for map coloring using csp algorithm this application include four color to colored 6 lables by csp algorithm | |
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... | |
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? | |
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 … | |
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 … | |
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............. | |
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> … | |
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 … | |
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 … | |
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 … | |
![]() | 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 … |
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 … | |
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 … | |
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 … | |
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> … | |
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 … | |
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 … | |
//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' && … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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++) { … | |
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... … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
i have to implement dijikstra algorithm using fibonacci heap............. i dint get any soltion for this problem............. :'( :'( :'( can anybody help me.....................:( | |
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 … | |
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 … | |
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 … | |
[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. … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … |
The End.