Posts
 
Reputation
Joined
Last Seen
Ranked #1K
Strength to Increase Rep
+5
Strength to Decrease Rep
-1
86% Quality Score
Upvotes Received
12
Posts with Upvotes
11
Upvoting Members
11
Downvotes Received
2
Posts with Downvotes
2
Downvoting Members
2
2 Commented Posts
1 Endorsement
Ranked #858
Ranked #818
~44.6K People Reached
Favorite Forums

75 Posted Topics

Member Avatar for cdea06

I don't see any validity checks done for your dates. He can enter invalid dates like 33/33/2012. Once the dates are validated, the job is easy. [CODE] day1 = yyyy1 * 10000 + mm1 * 100 + dd1 day2 = yyyy2 * 10000 + mm2 * 100 + dd2[/CODE] Check …

Member Avatar for rubberman
0
299
Member Avatar for subith86

I am planning to write an application in windows which will temporarily block the configured websites irrespective of what browser I am using. As I am completely a newbie in this I want to know where to start. Please provide me with any useful links which can help me. If …

Member Avatar for deceptikon
0
124
Member Avatar for dpsh

This [link](http://www.go4expert.com/forums/showthread.php?t=16676) explains better

Member Avatar for dpsh
0
94
Member Avatar for subith86

I have a code which gives the maximum value I can get by filling the knapsack with the optimal set of weights. int arr[5] = {0, 0, 0, 0, 0}; int Weight[5] = {2, 5, 8, 7, 9}; int Value[5] = {4, 5, 7, 9, 8}; const int n = …

Member Avatar for Lucaci Andrew
0
332
Member Avatar for vincent5487

if (0 > spendMinute) { spendMinute = 60 + spendMinute; spendHours-- ; } Add this piece of code at line 15. It will work

Member Avatar for subith86
0
204
Member Avatar for dakoris73

> cin >> Point::m_Xcoord >> Point::m_Ycoord; I didn't take the effort to understand what you are trying to do but there is definitely an error at line 38. You cannot access structure member variables using :: operator unless they are static. You need to create an instance of structure to …

Member Avatar for subith86
0
130
Member Avatar for mrexp21

Boost library is one option. But given that you are a beginner, and you want to go the hard way by using less complex C++ concepts, then think and note down how you will do this task if you were asked to do it manually. 1. take the given day, …

Member Avatar for subith86
0
145
Member Avatar for pokie_da_codie
Member Avatar for subith86

Anybody of you got any idea what this "internal compiler error: Segmentation fault" means? I searched internet, but didn't get anything useful. Then I did my analysis. I found out something peculiar. The code that I am trying to compile is a file for unit testing one of our classes. …

Member Avatar for mitrmkar
0
3K
Member Avatar for caltech
Member Avatar for NathanOliver
0
948
Member Avatar for dmoneyrpyt

Dude, this has hundreds of errors when I compiled. Either you post a proper code or point out which line of code concerns you.

Member Avatar for DJSAN10
0
233
Member Avatar for shreddinit

Why can't you do something like this. [CODE] unsigned int mm; //holds the month unsigned int dd; //holds the day unsigned int yy; //holds the year unsigned int ordinal_day = 0; //holds your ordinal day number //define an array which holds the number of days in each month unsigned int …

Member Avatar for shreddinit
0
296
Member Avatar for Silver-Eye
Member Avatar for zeroliken
0
165
Member Avatar for subith86

Hi, I have overloaded assignment operator like below and it worked perfectly fine. [CODE]void Test::operator = (Test& obj) { this->a = obj.a; this->b = obj.b; } [/CODE] But when I googled more about this, I could see all of the examples used a different prototype like this [CODE]Test& Test::operator = …

Member Avatar for subith86
0
134
Member Avatar for coxxie

Dude, you are giving us a 500 line code and asking us to find the bug. Why can't you debug a bit on your own and post only that code portion which is the reason for your "lock up"?

Member Avatar for coxxie
0
3K
Member Avatar for prasenjit_das
Member Avatar for subith86
0
68
Member Avatar for Sh0gun

why is there no enclosing brackets for the lines under for loop? Is it intentionally missed out? From the logic under for-loop, I don't think so

Member Avatar for subith86
0
175
Member Avatar for prasenjit_das

A tricky way, may not be the best way. Here it is: [CODE]#include <iostream> using namespace std; int main() { int a[2] = {1,5}; long addr1 = (long)(&a[0]); long addr2 = (long)(&a[1]); cout<<(addr2 - addr1)<<endl; return 0; } [/CODE] take absolute value of addr2-addr1 inorder to avoid a negative answer.

Member Avatar for Ali_2101
0
155
Member Avatar for MochiAnjali

Ok, if you want to retrieve the info at the last use "back" [CODE]a_student.assignments.back()[/CODE] If you want to retrieve from anywhere else using an index, use "at" [CODE]a_student.assignments.at(4)[/CODE] See this [URL="http://www.cplusplus.com/reference/stl/vector/"]link[/URL] for more info

Member Avatar for subith86
0
214
Member Avatar for picogenkaku

at line 29 you are setting seconds back to 0. So it's an infinite loop. Use a different variable in for loop condition.

Member Avatar for picogenkaku
0
240
Member Avatar for general07z

I didn't take the trouble in going through your entire code. But what sounds to me is that you have to use a static variable as ID. Initialize it to 1. increment it every time you add a patient.

Member Avatar for WaltP
0
2K
Member Avatar for phorce

[QUOTE=phorce;1760048]Hello, basically I want to return an array from a function (So I don't output things in the class - just main) But I seem to get the error: "invalid types 'int[int]' for array subscript" Here is the code: [code] #include <iostream> using namespace std; int matrix() { int matrix[10] …

Member Avatar for phorce
0
203
Member Avatar for pattmorter

[QUOTE=nezachem;1760178]Run away from that teacher as fast as you can. [CODE]y = 2*y++ + --x;[/CODE] [/QUOTE] Correct me if I'm wrong. But how is this an undefined behavior? I agree that the below line will give undefined behavior. [CODE]x = y++ * --y;[/CODE] Because we cannot predict which one (y++ …

Member Avatar for Ali_2101
0
194
Member Avatar for nell16

[QUOTE=nell16;1756980]1. Write a c++ program that generates the following series: 0 -1 4 -9 16 -25 36 -49 64 -81 100 and also this one - Nell[/QUOTE] Break it into two series 0 4 16 36 64 100 (square of even numbers starting from zero) -1 -9 -25 -49 -81 …

Member Avatar for Ali_2101
0
276
Member Avatar for butler273

try this :) [CODE]while(std::cin >> numberinput){ //std::cin >> numberinput; LinkedList.InsertFront(numberinput); }[/CODE]

Member Avatar for subith86
0
154
Member Avatar for shean1488

[QUOTE=shean1488;1758193]Yes it is, but not the way I want. The output is different[/QUOTE] It's pretty simple. You are not looping fully while printing. Make this change in line 40 - 43 (extra line added) and it will work. [CODE]for( i=0; i<c ; i++) { printf("%c", line[i]); } printf("%c", line[i]);[/CODE]

Member Avatar for subith86
0
141
Member Avatar for arubajam

use vector::assign See this [URL="http://www.cplusplus.com/reference/stl/vector/assign/"]link[/URL]. There is a similar example given.

Member Avatar for subith86
0
181
Member Avatar for shean1488

[QUOTE=thines01;1757547] The easiest way is just to set it to NULL.[/QUOTE] How is that possible? If you set it to NULL, the value will still be there and it is zero. [CODE] int a[5] = {1,2,3,4,5}; printf("%d", sizeof(a));//prints 20 as the size a[4] = NULL; printf("%d", sizeof(a));//prints 20 again [/CODE] …

Member Avatar for Smileydog
0
10K
Member Avatar for chamika.deshan

Are you asking what templates are? Or what is the job of template in your code? If you don't know what templates are, before trying to understand this code, you need to learn about templates. Take a good book or take some online material about templates and learn. I will …

Member Avatar for L7Sqr
0
163
Member Avatar for bennetk2

You are calling a non-const function by a const object. Hence the error. Make the functions as const and you'll get rid of this error. [CODE]int statistic::length() const { return amount; }[/CODE] There seems to be another solution to this. I haven't tried it and I seriously believe it is …

Member Avatar for gusano79
0
336
Member Avatar for christian03

What problem are you facing? Post the error that you get. Also please edit your first post by aligning the code properly and wrap [code] tag so that it is easily understandable for us to analyze.

Member Avatar for Lerner
0
227
Member Avatar for Dumb Fish

[QUOTE=Dumb Fish;1749077]hi, i need to ask how to generate the negative answer? i have one formula. But always give me positive answer.. For exmaple: [B]AllocatDiff2 = 100 * -0.05;[/B] hope somebody can help me ...ASAP!! Thanks ...[/QUOTE] is AllocatDiff2 and unsigned int?

Member Avatar for thines01
0
166
Member Avatar for Mxous

How about this??? :cool: [CODE] unsigned int grade_index; unsigned int score = 35; //this is your score. use scanf to get it. grade_index = score/55 + score/65 + score/75 + score/85; char grade = 69; grade = grade - grade_index; printf("%c", grade); [/CODE]

Member Avatar for Mxous
0
137
Member Avatar for subith86

I am trying to implement my own version of BigInteger which can hold an arbitrary big integer. I have posted my BigInteger.h file here and I need your suggestions if there is any better design for this. 1. std::string private member will hold the BigInteger in the form of string. …

Member Avatar for VernonDozier
0
2K
Member Avatar for srinath1

You are passing the pointer by value. And you are swapping the copy of the actual pointers in swap() function. When it comes out from the function, the pointers' copies go out of scope and hence no swap happens. One solution is to pass the pointer by reference. Other solution …

Member Avatar for srinath1
0
118
Member Avatar for ztdep

What I understand from your requirement is that your Swarm object will contain Particle(s). Each Particle has a unique dimension_id. Why can't you use map in Swarm class. A map where the key is dimension_id and value is a Particle object. Please correct me if my understanding of your requirement …

Member Avatar for jaskij
0
97
Member Avatar for rmbrown09
Member Avatar for avenger123321
Member Avatar for lmytilin
Member Avatar for Lerner
0
180
Member Avatar for jigglymig

That didn't look like a circular linked list. Anyway, I made a few corrections and it worked fine. [CODE]void add() { int n; cout << "What is n? "; cin >> n; if (n > 0) { Head = new(node); Head -> Item = n; Last = Head; for (int …

Member Avatar for Lerner
0
107
Member Avatar for Ayzu

1. Line 49 : It should be [CODE]temp1->ptr=temp;[/CODE] 2. Line 67 and 69 : You repeat the same statement. Delete both the lines and bring one of them after the if-condition. [CODE]if(temp1->ptr==NULL) {return 0;} temp1=temp1->ptr;[/CODE] Now it's up to you to think and find what error you made and how …

Member Avatar for Ayzu
0
245
Member Avatar for jdm

[CODE]bool dayType::equalDay(const dayType& otherday) const { return (this->day == otherday.day); } [/CODE] "this" is the object with which you are calling equalDay(). You are comparing this's day and otherdays's day and returning the result.

Member Avatar for jdm
0
97
Member Avatar for rfrapp

I didn't try to understand what you are doing in your code. But, I see one mistake. Variables like digit10 which is of int type cannot hold such a big value. If int is of 4 bytes, it can go only till 2147483647 but digit10 is assigned with 68719476736.

Member Avatar for WaltP
0
290
Member Avatar for firebird102085

[QUOTE=firebird102085;1740892] Error 1 error C2106: '=' : left operand must be l-value (error on line in bold) [/QUOTE] Did you mean to put the value you get after summing [B]sum[/B] and [B]count[/B] into [B]ex[/B]. If so, you should do like this. [CODE]ex = sum + count;[/CODE] [QUOTE=firebird102085;1740892] Warning 2 warning …

Member Avatar for MandrewP
0
4K
Member Avatar for myrongainz

the reason why no body is helping is that your code is not intended at all, which makes it difficult for us to read. Please format it with proper intendation and the re-post. Also remove all the blank lines in between.

Member Avatar for zeroliken
0
201
Member Avatar for stereomatching

[QUOTE=stereomatching;1739284] I write a small program to measure the time [/QUOTE] Why don't you put the solution in a loop. Loop it some 100000... times, so that your program will give you some number. Do it separately for both solutions.

Member Avatar for mrnutty
0
121
Member Avatar for mcddewitt

I find lot of bugs in your code. 1. In the main function you are calling [B]createAndCount()[/B] without any arguments, but where as from the signature of the function, it is seen that it accepts an integer. 2. In [B]count()[/B] you are using a variable 'n' in the for loop. …

Member Avatar for subith86
0
225
Member Avatar for PrimePackster

You can simply enter your input separated by spaces. It need not be \n character always. For cin>>i>>j; you can actually enter two numbers separated by space. Or, you want a space to be inserted when you press enter, and wait for the next input?

Member Avatar for PrimePackster
0
258
Member Avatar for sync101

check this link, this should help you [url]http://linux.die.net/man/3/strtol[/url] For C++ programmers, there is another solution [url]http://www.cplusplus.com/articles/numb_to_text/[/url]

Member Avatar for WaltP
0
191
Member Avatar for freedomflyer

[QUOTE=freedomflyer;1738022] once it gets back to process_and_display_information, the data is gone.[/QUOTE] Yes, it will be gone, because the scope of [B]myStrings[/B] is only within [B]tokenize_urls[/B](). [B]myStrings[/B] is created in the stack and once the control goes out of [B]tokenize_urls[/B](), the memory will be freed. That is why you lose your …

Member Avatar for Ancient Dragon
0
183

The End.