506 Posted Topics

Member Avatar for gaurav_13191

Can you post your code? If you have implemented the search using recursion you won't need to store the parent info inside each node.

Member Avatar for thekashyap
0
425
Member Avatar for leftovas17

[CODE]#include<stdlib.h> #include<stdio.h> #include<string.h> typedef struct linked_list_elem { char *val; struct linked_list_elem* next; } t_linked_list_elem; t_linked_list_elem* head = NULL; t_linked_list_elem* tail = NULL; // Finds given string in given linked list. // returns: the t_linked_list_elem matching the string if found, // NULL otherwise. t_linked_list_elem* findItem (const char* string); // If string …

Member Avatar for leftovas17
0
497
Member Avatar for Deto4ka

[CODE]public double averageAge() // calculating average age in each BMI group { double numbers[] = new double[this.list.length]; // KASH: You probably need an array to store // totals as well. One total per "cat". double result = 0; char[] cat = {'O', 'U', 'N'}; for (int i = 0;i < …

Member Avatar for thekashyap
0
162
Member Avatar for kukuruku
Member Avatar for Casper3912

Actually you're pretty far from linking trouble. You have major compilation issues. Few things you need to fix and remember: 1. DO NOT USE things like "Student", "iostream", "Name", "Date" as include guards. Make YOUR include guards unique. Qualify these names with your street address if needed. E.g. #ifndef student_Casper3912_myCountry_myCity_myStreet. …

Member Avatar for thekashyap
0
189
Member Avatar for uc-it
Member Avatar for eskimo456

Is performance your concern? Without knowing: - What defines a grid cell? and - How you define "overlap"? I can give general comment that assuming to find out overlapping cells you'll have to compare all cells with all other cells, I suggest 1. some struct with better random access (vector, …

Member Avatar for eskimo456
0
148
Member Avatar for xanawa

Is your question how to use the regEx or where to do the validation?

Member Avatar for xanawa
0
77
Member Avatar for mclemon

If you want fancy stuff [URL="http://www.java2s.com/Tutorial/Cpp/0500__STL-Algorithms-Non-modifying-sequence-operations/Useforeachfunctiontoprintallelementsinavector.htm"]use STL for_each[/URL]. So if you have 3 vectors to print then your code would look like this: [CODE=C++] vector<int> vec1; vector<char> vec2; vector<float> vec3; for_each (vec1.begin(), vec1.end(), print); for_each (vec2.begin(), vec2.end(), print); for_each (vec3.begin(), vec3.end(), print); [/CODE] Even if you don't want fancy stuff, …

Member Avatar for vijayan121
0
103
Member Avatar for titosd

It would print something after demo3 IF you had written [CODE]e.printStackTrace(); // instead of e.fillInStackTrace(); // on line 56 [/CODE]

Member Avatar for thekashyap
0
133
Member Avatar for duliduli556

None of [URL="http://www.google.com/search?q=reference+counting+with+smart+pointers"]these[/URL] helped?!

Member Avatar for jonsca
0
80
Member Avatar for benchz23

You should first (before writing code) think what would the algorithm look like. I think it should look like this: [iCODE] while i've not printed 6 lines{ print next line } print next line() { required number of numbers to be printed = ??? while I've not printed required number …

Member Avatar for Fbody
0
172
Member Avatar for rayden150
Member Avatar for xyzt

Safest would be to have some shared variables between teh monitoring thread (one running main) and monitored threads (t1, t2). When the condition is met, monitoring thread sets the variable to indicate that monitored threads should exit now. This would give an option to t1/2 to gracefully shutdown. Also I …

Member Avatar for thekashyap
0
176
Member Avatar for wdearth

WaltP>> By the way, leave the computer alone until: I concur.. :) One other pointer I can give is to google up a bit on pre/post/in-fix notations and their use.

Member Avatar for thekashyap
0
116
Member Avatar for andyhunter

In OOAD grouping of related attributes (e.g. FirstName, LastName, Title,..) is achieved by creating a class (say Person) and adding "FirstName, LastName, Title" as attributes/member-variables to the class. Now each instance of this class would have all the attributes. What you then do is create an ArrayList of Person.

Member Avatar for thekashyap
0
151
Member Avatar for Alpdog14

[QUOTE=Alpdog14;1511940]Can anyone guide me on how to create the tests for this?[/QUOTE] In eclipse, right click on the .java file and say New->JUnit Testcase.. :) Select the methods you want to test, then implement the methods.

Member Avatar for JamesCherrill
0
183
Member Avatar for Tazsweet19

Did you read up anything on [URL="http://www.google.com/search?q=java+socket+example"]how to use sockets in Java[/URL]? First 2 results seem good enough..

Member Avatar for Tazsweet19
0
117
Member Avatar for pythonbegin

[QUOTE=JamesCherrill;1513468]Windows: javaw -jar myJar.jar arg1 arg2[/QUOTE] Works only if MANIFEST has required mainClass entries. Can't assume all jars have it. I don't really understand what's the problem here. They've given you the command, which seems to be simple enough. Just run it! Call the script like this: [ICODE]xyz_script.sh C:\init_file.ini[/ICODE]

Member Avatar for JamesCherrill
0
215
Member Avatar for tangentplane

A bit surprising.. It works for me even when VendingDisplay is defined in the cpp instead of header. The error that you said VS gives you "error:no instance of overloaded function VendingDisplay::VendingDisplay matches the specified type", which line number did it correspond to? When you do [iCODE]MyClassInstance1 = MyClassInstance2;[/iCODE] copy …

Member Avatar for thekashyap
1
4K
Member Avatar for NvIs

Search..! Narue has posted many sorting [URL="http://www.daniweb.com/forums/search.php?searchid=15717592"]code snippets[/URL]: Not all are in C/C++ but you should get a hang of the algorithm at least e.g. - [url]http://www.daniweb.com/software-development/java/code/216339[/url] --edit-- And not to forget: [url]http://en.wikipedia.org/wiki/Sorting_algorithm[/url] A good [U]reference[/U] book is [URL="http://www.google.com/search?q=Introduction+to+Algorithms+Cormen"]Introduction to Algorithms[/URL].

Member Avatar for thekashyap
0
173
Member Avatar for MasterGberry

As AD said you can't de-compile C/C++ compiled code. You can "re-package" a library only if it's static library, not dynamic. OP>> "I am using microsoft visual studios" Given what you're trying to do I recommend you export the makefile and have a look to see what's happening behind the …

Member Avatar for thekashyap
0
2K
Member Avatar for echocoder
Member Avatar for c_newbie1

Reposting the code so I can see it better. [CODE] #include<stdio.h> #include<conio.h> int main() { int no, line, i, j, k, m, end_of_part2, l, no_of_numbers; printf ("Enter number to get pattern up to that number.."); scanf ("%d", &no); for (i = 0;i <= no;i++) { for (j = 0;j <= …

Member Avatar for thekashyap
0
244
Member Avatar for ChaseRLewis

Can you send the command lines and the outputs with error? Also given that there is nothing "not-extern" in the headers you posted, the problem (repeated definition of...) can't be due to these as extern doesn't [I]define[/I] anything it only [I]declares[/I]. Hope you do know the [URL="http://www.daniweb.com/software-development/cpp/threads/131659"]use of extern[/URL]. --edit-- …

Member Avatar for mike_2000_17
0
162
Member Avatar for chinee
Member Avatar for CSWalls
Member Avatar for CSWalls
0
213
Member Avatar for virtue

You need to create a rule to convert .c (or .cxx, .cpp) file into a .o file. Something like: *.o: *.C gcc ... It's been 4 years so I forgot the syntax. :) But this bare-bone Makefile. You should be able to find an example from the gcc documentation itself. …

Member Avatar for thekashyap
0
171
Member Avatar for CorruptionInc

[CODE]package com.kash; import java.util.Scanner; import java.util.StringTokenizer; public class TestMain { public static void main(String[] args) { int pos = 0; String input; Scanner s = new Scanner(System.in); int count = 0; while (true) { System.out.print("Enter a sentence: "); input = s.nextLine(); System.out.println("input = \"" + input + '"'); StringTokenizer str …

Member Avatar for CorruptionInc
0
116
Member Avatar for Poopster01

[CODE]java TestDie[/CODE] If you're using eclipse. Right click on TestDie and say Run as->Java Application. PS: Usage of drivers is stone age. In the new world they use JUnits.

Member Avatar for thekashyap
0
227
Member Avatar for fsamu2001

[QUOTE=fsamu2001;1510415][CODE]#include<iostream> #include<string> #include<iomanip> using namespace std; //function prototype void sortData(string* ,int*); void calcAverage(int*, int); void displayData(string* , int*, int); int main () { // pointer variables string* name; int *score; int size; int counter; //dynamic variables // user enter score cout<<"How many test scores will you enter?"; cin >> size; …

Member Avatar for thekashyap
0
145
Member Avatar for programing

[QUOTE=programing;1510412]plz how i can delete a specific value in linkedlist ..[/QUOTE] [CODE] #include "the_code_that_I_wrote.h" int main() { //... create and populate the list here.. delete_specific_value(myList, specific_value); return 0; } [/CODE] In case it's not obvious, [ICODE]the_code_that_I_wrote.h[/ICODE] contains the implementation of [ICODE]delete_specific_value()[/ICODE].

Member Avatar for thekashyap
0
94
Member Avatar for aswad56

Polymorphism is a side-product of good OO design. It's not something you design. What part do you want to make polymorphic? The drink? If yes, just create 10 subclasses of drink, one for each type and hardcode teh values you're passing in c'tors on lines 29-37.

Member Avatar for thekashyap
0
92
Member Avatar for blur blur

[QUOTE=griswolf;1510551]char is in fact a (very small) integer type. To convert the string of char to int, use atoi() or something similar.[/QUOTE] From atoi(3) " DESCRIPTION The atoi() function converts the initial portion of the string pointed to by nptr to int. The behaviour is the same as strtol(nptr, (char …

Member Avatar for thekashyap
0
114
Member Avatar for biancaW

1. Where in your code are you actually checking if "a set was in alphabetical order to start with, and needed no rearranging."?? Currently your code is [CODE] ins.open("data.txt"); // input original data. while(!ins.eof()) { INORDER = set; // <<-- ... set++; // <<-- } ... cout << "NUMBER OF …

Member Avatar for thekashyap
0
131
Member Avatar for jinglylime

Seems like when you do call the pedal(), it would return you the new position (say P1). But the next time you call pedal again, it would still give you P1. You should also call [iCODE]rollForward()[/iCODE] of both wheels inside pedal() to update required members inside wheel objects. --edit-- The …

Member Avatar for thekashyap
0
133
Member Avatar for gyuunyuu

See [URL="http://en.wikipedia.org/wiki/Reverse_Polish_notation#Postfix_algorithm"]this[/URL].. Specifically this part: * It is known a priori that the operator takes n arguments. * If there are fewer than n values on the stack ** (Error) The user has not input sufficient values in the expression.

Member Avatar for thekashyap
0
134
Member Avatar for TheWhite

ps supports and option "h" (not -h) that suppresses the header from getting printed. See "OUTPUT FORMAT CONTROL" section in "man ps".

Member Avatar for thekashyap
0
118
Member Avatar for vasuv

I would recommend Office VB script. Easy and powerful, takes a day or two to learn but has very wide application.

Member Avatar for thekashyap
0
96
Member Avatar for luke710
Member Avatar for rajeevpareek

Space between -D and CORE is the problem [CODE=bash]$ gcc -o finame -DCORE="op1_log.txt" finame.c[/CODE]

Member Avatar for thekashyap
0
7K
Member Avatar for rjbrjb777

You can: - Define a struct that has time stamp and the whole string (as read from file) as members. - Define an array of this struct. - Write a function to read the file and populate the array. - Write a function that can sort the array of structs, …

Member Avatar for WaltP
0
4K
Member Avatar for Alice1990
Member Avatar for Newskin01

1. Code you posted shouldn't be compiling as Object doesn't have getName(). 2. "However when I use this method it doesn't remove anything": How do you check whether something is removed or not? E.g. if you expect that the size of the array would change then know that it won't. …

Member Avatar for thekashyap
0
528
Member Avatar for dark3lf

Simpler would be: [CODE] #!/bin/sh # usage: get_mount path # returns: mount pount of given usb path if [ $# -eq 1 ]; then df -h | awk /$1/'{print $6}' else echo "Usage: `basename $0` path" fi # One liner: # [ $# -eq 1 ] && df -h | …

Member Avatar for thekashyap
0
202
Member Avatar for coding101

AFAIK there is no algorithm to get morse code given an alphabet. So you can not avoid a maintaining this mapping. But if you're using array(s) that's not so good. Use map.

Member Avatar for Adak
0
90
Member Avatar for dem10
Member Avatar for gyuunyuu

Here is the pseudo-code: [CODE] // Create an array of char*(s) // You might be forced to use a custom struct (see comments // below) if you want to control the memory usage. while (fscanf(myfile, "%s", str) != EOF) { // Extract each word (find index of next white space …

Member Avatar for thekashyap
0
209
Member Avatar for canyvr

At least read the output printed by your script ! woooee has been nice enough to add traces to your script, don't expect s/he isn't going to DO IT for you. HINT: How many times do you expect "[ICODE]print "comparing", s[index], s[-1-index], "for index", index[/ICODE]" to be executed and check …

Member Avatar for canyvr
0
157
Member Avatar for cig_buttz

[CODE] public class DaniWebHelper { public static void main(String[] args) { String[] questions = { "Frequency count", "Stack and queue", "Conversion of infix to postfix using stack", "binary search tree" }; for (String q : questions) { String url = "http://www.google.co.in/search?q=QQQ+site%3Awww.daniweb.com"; System.out.println("Answer to \"" + q + "\":\n\t- Open a …

Member Avatar for thekashyap
0
211

The End.