Posts
 
Reputation
Joined
Last Seen
Ranked #787
Strength to Increase Rep
+7
Strength to Decrease Rep
-1
100% Quality Score
Upvotes Received
51
Posts with Upvotes
49
Upvoting Members
26
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
7 Commented Posts
4 Endorsements
Ranked #397
Ranked #425
~109.81K People Reached
Favorite Tags

133 Posted Topics

Member Avatar for histrungalot

["Objects that are instances of an inner class exist within an instance of the outer class"](http://docs.oracle.com/javase/tutorial/java/javaOO/nested.html) Even though I attempt to create an independent instantiation of the inner class, the outer class is always there because of the statement above. ##Is that ture? If true, then that would also mean …

Member Avatar for histrungalot
0
176
Member Avatar for Major Aly

##You can't return a pointer from off the stack. Add the error handling #include <cstdio> #include <iostream> using namespace std; struct student { int SUB[3]; }; struct AVGPCT { float avg; float pct; }; AVGPCT* CALC(student *A) { int x,y; //--------------------------------------- // Have to allocate the memory here AVGPCT *D …

Member Avatar for histrungalot
0
364
Member Avatar for jude416

Yes, need more context. Post more. And tell us what it is doing that makes you say that it doesn't work.

Member Avatar for DeanMSands3
0
283
Member Avatar for angelineang

Read this http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html and look at the section **Rounding Error**. ##Play around with this #include <iostream> #include <iomanip> #include <cmath> // Might need this later #include <cfloat> using namespace std; int main(){ // a / b = c = c // (1/9) / (1/3) = 3/9 = 1/3 float a(1.0f/9.0f),b(1.0f/3.0f),c(1.0f/3.0f); …

Member Avatar for geojia
0
134
Member Avatar for nataraja833

You didn't allocate memory for the cell inside the INST. [code] for ( j = 0; j < i; j++ ) { top_inst_list[j] = (INST *)malloc(sizeof(INST)); top_inst_list[j]->name = (char *)malloc (sizeof(char) * 10); // You need to allocate memory for the CELL before you start to access // top_inst_list[j]->cell->name top_inst_list[j]->cell …

Member Avatar for deceptikon
0
139
Member Avatar for triumphost

##Would this work http://www.cplusplus.com/reference/std/locale/collate/hash/

Member Avatar for triumphost
0
137
Member Avatar for mchung90

##See comments in code #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <sys/mman.h> #include <sys/types.h> #include <ctype.h> //---------------------------------------------------------- // Added for fstat #include <sys/stat.h> int main(int argc, char * argv[]){ //---------------------------------------------------------------------------- // Added for fstat struct stat sb; int fd, pagesize,i; char *data, x; if (argc != 2){ //-------------------------------------------------------------------------- // Here …

Member Avatar for mchung90
0
139
Member Avatar for mike_2000_17

##If using GCC version < 4.7.0 (me 4.6.3) need to uncomment out this as Mikael Persson indicates // For GCC version < 4.7.0, use this replacement for the template alias: // template <typename T> // struct locked_ptr { // typedef const detail::locked_ptr_impl<T>& type; // }; ##And replace all locked_ptr<const std::string> …

Member Avatar for mike_2000_17
3
1K
Member Avatar for lxXTaCoXxl

If you are inserting at the front each time, DataAt(i) will always return the first element you added. Ex: InsertAtFront(22): 22 DataAt(0) = 22 InsertAtFront(33): 33, 22 DataAt(1) = 22 InsertAtFront(44): 44, 33, 22 DataAt(2) = 22 etc ...

Member Avatar for histrungalot
0
208
Member Avatar for iAndrewMeyer

> /* Memory allocation */ > array = (int**)malloc(sizeof(int) * ROWS); ##Should be /* Memory allocation */ array = (int**)malloc(sizeof(int*) * ROWS); sizeof(int) and sizeof(int *) would be different on 64-bit machine.

Member Avatar for Trentacle
0
141
Member Avatar for dyl_ham

##@dyl_ham, your last try was really close. Just move some things around. #include <iostream> #include <fstream> #include <cstdio> #include <cerrno> using namespace std; ifstream * openInputFile() { string fileName; cout << "Please enter a valid file name: "; cin >> fileName; //--------------------------------------------------- // You have the file name, just use …

Member Avatar for dyl_ham
0
1K
Member Avatar for paranoidSandra

##Try if(childpid > 0){ //parent close(pipe2[1]); close(pipe1[0]); client(pipe2[0], pipe1[1]); //--------------------------------------------------- // I moved these, you have to close the pipes // so the server can exit and then the wait // will catch the exit of the server. close(pipe2[0]); close(pipe1[1]); wait(&status); exit(0); } ##Now `while(read(readfd, am, sizeof am) > 0)` …

Member Avatar for paranoidSandra
0
121
Member Avatar for SCass2010

##This works for me and I'm using the same g++ (gcc version 4.1.2 20080704).## #include <iostream> using namespace std; typedef int DOMNode; class MyDOMNode { public: MyDOMNode (DOMNode* node): mDomNode (node) { cout << "Constructor: " << node << endl; } bool operator== (const MyDOMNode& rhs) { if (mDomNode == …

Member Avatar for deceptikon
0
163
Member Avatar for Crynix

##See if this helps, look at comments.## #include <iostream> #include <string.h> #include <sstream> using namespace std; struct Item { string itemDescription; int quantity; float wholesaleCost, retailCost; string dateAdded; }; int main(){ Item temp; //file.read((char*)&temp.itemDescription, readsize); //####################################### // Comment this out for this to work read(1,(char*)&temp.itemDescription,4); //##################################################### // // temp.itemDescription // …

Member Avatar for histrungalot
0
351
Member Avatar for mcjiwe

##See if this helps, look at the comments.## #include <string.h> #include <stdio.h> //####################################### // This must be what your structure // looks like struct { char *nome; char *identificadorNum; char *quantStock; char *limMin; char *consumoMed; } ingredientes[4]; //####################################### // This is what it should look like struct { char nome[10]; …

Member Avatar for mcjiwe
0
141
Member Avatar for 9tontruck

Just ran you code and it worked for me: #include <iostream> #include <string> #include <cstdio> #include <curl/curl.h> int main(void) { CURL *curl; curl = curl_easy_init(); if(!curl) { std::cout << "Unable to initialize cURL interface" << std::endl; return -1; } std::string curl_url = "https://www.cia.gov/"; curl_easy_setopt(curl, CURLOPT_URL, curl_url.c_str()); curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0"); curl_easy_setopt(curl, …

Member Avatar for 9tontruck
0
3K
Member Avatar for coutnoob

I don't think you want to have it scoped to the Circle class. If it was then you wouldn't have to be a friend.

Member Avatar for histrungalot
0
351
Member Avatar for Lucaci Andrew

When you get to it, void B::add(int id, string name, int age){ A *a; a=new A; a->setid(id); a->setname(name); a->setage(age); list.push_back(*a); } is leaking memory. You define list as `vector<A> list;` and in the add function allocate memory for an A class but when you add it to the list it …

Member Avatar for gusano79
0
712
Member Avatar for haris riaz

Using a recursive function as well. I just have one more bug (I think). I thought that function was getting to complex but maybe not. Got to solve it, it's consuming me now.

Member Avatar for histrungalot
0
163
Member Avatar for risen375

Change line 223 from `dobule weightInKg = convertLbToKg(weight);` to `weightInKg = convertLbToKg(weight);` You defined weightInKg at line 201 and then again at line 223 but then you used it in 275. But were you set it at line 223 is a different scope then the one defined at 201.

Member Avatar for histrungalot
0
131
Member Avatar for Z33shan

What do the values in the matrix represent? And why is T1 -> p1 T2 -> p2 T3 -> p3 T4 -> p1 the best? Trying to understand your problem a little more.

Member Avatar for raptr_dflo
0
298
Member Avatar for jwill222

> I tried to do linear probing in the above ... Looking at the link you gave, it looks like they want you to use link-lists for the collisions because in the section were it talks about >b. when requested, analyze the efficiency of the hashingalgorithm for this set of …

Member Avatar for jwill222
0
613
Member Avatar for pattilupwned
Member Avatar for histrungalot
0
191
Member Avatar for saneeha.nust

Should `generate_combination()` be an operation of the class bruteFrce? Like `void bruteFrce::generate_combination(int)` or should it really be outside the scope of the class bruteFrce?

Member Avatar for histrungalot
0
249
Member Avatar for pattilupwned

Use erase: http://www.cplusplus.com/reference/string/string/erase/ `string& erase ( size_t pos = 0, size_t n = npos );` "pos: Position within the string of the first character to be erased." "n: Amount of characters to be removed." void setSecretCode (char code[4]) { string colors = "RGBYO"; int pos; srand(time(NULL)); pos = rand() % …

Member Avatar for pattilupwned
0
312
Member Avatar for histrungalot

##I was working on something and saw this oddity, thought I would share it. $ ./a.out in.val = 86.3115158 -> Its a valid floating point number out1.val = nan -> Swapped it and now its a NaN! That's OK swap it back. out2.val = 86.4365158 -> What, its not the …

Member Avatar for histrungalot
0
178
Member Avatar for FraidaL

Its wraping around. $ ./a.out i(0) f1(9) f2(-8) <------ Should have stopped here i(1) f1(12) f2(-6) i(2) f1(18) f2(-4) i(3) f1(24) f2(-3) i(4) f1(36) f2(-2) i(5) f1(72) f2(-1) i(6) f1(-72) f2(1) i(7) f1(-36) f2(2) i(8) f1(-24) f2(3) i(9) f1(-18) f2(4) i(10) f1(-12) f2(6) i(11) f1(-9) f2(8) <------ When all of …

Member Avatar for histrungalot
0
637
Member Avatar for bgx90

You forgot to put the RefEnv:: infront of the two functions get_var and get_func. std::map<std::string, VarIdent>::iterator RefEnv::get_var(std::string s){ std::map<std::string, FuncIdent>::iterator RefEnv::get_func(std::string s){ And you have the wrong type for the second map template para. bool RefEnv::insert_func(Type t, std::string key, std::string n){ //Precondition: // A RefEnv object exists // //Postcondition: // …

Member Avatar for bgx90
0
3K
Member Avatar for phorce

##Try, but only tested it a little #include <vector> #include <iostream> using namespace std; int main(){ vector<int> m1,m2,m3; m1.push_back(0); m1.push_back(1); m1.push_back(1); m1.push_back(0); m1.push_back(0); m1.push_back(1); m1.push_back(1); m1.push_back(1); m1.push_back(1); m1.push_back(0); m1.push_back(1); m1.push_back(1); m1.push_back(0); m1.push_back(0); m1.push_back(0); m1.push_back(1); m2.push_back(0); m2.push_back(1); m2.push_back(0); m2.push_back(1); //------------------------------------------ // Just thinking // 1 2 3 4 5 6 // …

Member Avatar for histrungalot
0
178
Member Avatar for SillyNoob

Not at home to check it out but I pretty sure that your problem is, you are returning a pointer to something on the stack. ScoreEntry** retEntry = &newEntry; return retEntry; newEntry is a local variable and when you leave the Load function its address is no longer valid. Why …

Member Avatar for SillyNoob
0
93
Member Avatar for jbennet

Yeah phorce, it seems like I only get emails once in the morning. I checked send email on threads I post on but not getting updates when there is activity on thread.

Member Avatar for Airshow
0
2K
Member Avatar for Nole_diver

Not infront of my computer to test, but I think you need to [icode]chomp($choice)[/icode] to get rid of the '\n'. The '\n' is on the end of $choice which is why it is failing. [url]http://perldoc.perl.org/functions/chomp.html[/url]

Member Avatar for 2teez
0
120
Member Avatar for John Linux

##See if this helps #!/bin/bash if [ -d $1 ] then cd $1 for file in $(ls *.jpg) do newfile=${file%.jpg}"_DEFAULT"${file:(-4)} echo "New file name: $newfile" done else echo "Directory $1 doesn't exist" fi ## Testing ## $ ls ./temp P100.jpg P172.jpg P342.jpg P400.jpg $ ./myScript temp/ New file name: P100_DEFAULT.jpg …

Member Avatar for histrungalot
0
253
Member Avatar for dwlamb

If you put #!/bin/bash (wherever bash is for you) as the first line in the script, do you still get the error?

Member Avatar for dwlamb
0
124
Member Avatar for Labdabeta

Just curious, why are you integrating over the CDF and not the PDF? And wouldn't the value of x->infinity = 1 - chicdf(x) (chicdf not being the integral but the value of chicdf at x)? Just thinking, I could be totally wrong.

Member Avatar for Labdabeta
0
618
Member Avatar for sumi1234

Here is some code to mess with. The first code chunk is the scheduler-ish program. It forks a child program that receives an amount of time to sleep from a pipe and outputs time slept to another pipe to the parent. If the current working directory is not in your …

Member Avatar for histrungalot
0
2K
Member Avatar for Nawaf15

In function `void openFile(Person list[], int& size)` you don't increment the value of size, so it loaded but you never changed the value of size so it looks as if zero were loaded. You could use STL sort. http://www.cplusplus.com/reference/algorithm/sort And a compare function like: bool compPerson(Person p1, Person p2){ if( …

Member Avatar for histrungalot
0
204
Member Avatar for themenucha

Not really sure what you want this program to do. I had to change the sem_init to sem_open because I have a Mac (should change the functionality). I didn't check anything else like memory leaks, so see if this helps. Jobs are added to the queue and each thread processes …

Member Avatar for histrungalot
0
422
Member Avatar for hawkeyeviewonu

I didn't look all of it but on line 38 is one of your issues. // The check on i is not correct, it will never // enter the loop for(int i=10;i<=0; i--) // It should be i greater than or equal for(int i=10;i>=0; i--)

Member Avatar for histrungalot
0
985
Member Avatar for hwoarang69

Try something like: #include <string.h> #include <stdio.h> void funct1(char line2[]) { char *tem_tptr; tem_tptr = strtok(line2, " \t\n"); //here i should have value add, or sub if(tem_tptr != NULL) { printf("\tInside funct1: %s\n",tem_tptr); } } int main() { char line2[20]; char tem_line2[20]; char *tptr; while(fgets(line2,20,stdin)) //read one line and store …

Member Avatar for histrungalot
0
255
Member Avatar for hay123

http://en.wikipedia.org/wiki/Standard_deviation The standard dev is the square root of 1/N*sum (x-mean)^2. float stDevSum(0); for(int testNum = 0; testNum < 15; testNum++) { stDevSum += powf((numbers[testNum]-mean),2.0f); } stDev = sqrt(stDevSum/15); You might also see it done as sqrt(E[X^2]-E[X]^2) but if the standard dev is really small you might get NAN (Not …

Member Avatar for histrungalot
0
259
Member Avatar for nee_88

That will always happen. '.' is the current directory and '..' is the parent directory. while((direntry=readdir(dir))!=NULL) { // If the first character is a dot, then skip it if ( direntry->d_name[0] == '.' ) continue; printf("%d %s\n",i,direntry->d_name); i++; } closedir(dir);

Member Avatar for nee_88
0
251
Member Avatar for Niner710

[code=perl] #!/usr/bin/perl $i = "|,0.005,0.004,0.004,0.005,0.006,0.005,0.006,0.005|,0.005,0.006,0.004,0.005,0.005,0.004,0.004,0.006|,0.004,0.004,0.004,0.004,0.004,0.005,0.004,0.004|,0.005,0.003,0.004,0.004,0.005,0.005,0.004,0.003|,0.005,0.003,0.004,0.004,0.005,0.004,0.005,0.004|,0.004,0.004,0.004,0.004,0.004,0.003,0.005,0.004|,0.005,0.004,0.005,0.005,0.005,0.005,0.005,0.004|,0.005,0.005,0.005,0.005,0.005,0.005,0.004,0.004"; # I have to get rid of the first '|,' otherwise the first # element in the array will be empty. If you don't mind # then you can delete this line and just use the split $i =~ s/^\|,//; @values = split(/\|?,/,$i); foreach $elm …

Member Avatar for 2teez
0
173
Member Avatar for CKShia

In the client code: On line 23 use the length instead of strlen. If you read 4096 bytes then there is not '\0' for strlen to stop at. That is why the first print out of the number of bytes received (4102) is over 4096. On line 10, 11, 19 …

Member Avatar for histrungalot
0
1K
Member Avatar for TheFearful

You should do it in pieces. 1.Start with reading and parsing the XML file first. This may be the function that takes you the longest. Create a program the takes in the file name, opens the file and parses out each (x, y) and prints them to the screen. Once …

Member Avatar for histrungalot
0
245
Member Avatar for xtinab

This works in my head, can't check it unless I code it up or some simple binary tree. At the end the value return by HuffmanCode will have the encoded value **not code (third arg)**. int main() { // etc... someChar = 'n'; wrkingTmp = ""; // <--- Will not …

Member Avatar for histrungalot
0
1K
Member Avatar for ashboi

Reference: http://en.wikipedia.org/wiki/Single-precision_floating-point_format #include <iostream> // Needed for the hex, showbase, setfill and setw #include <iomanip> using namespace std; int main(){ // Set the floating point number float floatVal(-1); // Want the integer form of what the float looks like, not the integer // part of the float. unsigned int intValOfFloat(*reinterpret_cast<unsigned …

Member Avatar for histrungalot
0
89
Member Avatar for osiron

I'll start you off. I changed the qsort compare function for IDs and the call parameters to [qsort](http://www.nsc.ru/cgi-bin/www/unix_help/unix-man?qsort+3). >The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the …

Member Avatar for osiron
0
188
Member Avatar for FraidaL

Check out this vs. what you have. $ ./a.out Please enter a size for the square: 5 Please enter first symbol: + Please enter a second symbol: * * + * + * + * + * + * + * + * + * + * + * + …

Member Avatar for FraidaL
0
190
Member Avatar for phummon

I think you are going to have to make a map of string to enum. std::map<std::string, NyNumbers> theMap; theMap["First"] = First; // etc... std::map<std::string, NyNumbers>::iterator pos; if ( (pos = theMap.find(argv[1])) != theMap.end()){ // Found!! cout << Matrix[pos->second]; // etc... }

Member Avatar for phummon
0
335

The End.