Forum: C++ 4 Days Ago |
| Replies: 8 Views: 253 you can write a function to check if the value is equal to any of those given values and return a bool value
for example:
bool checkValue(char c)
{
return ((c == 'r') || (c == 'p') ||... |
Forum: C++ 4 Days Ago |
| Replies: 8 Views: 253 while( (g.one != 'r') || (g.two != 'p') || (g.three != 'g') || (g.four != 'm'))
that's how you give multiple values, you can modify it to suit your requirement |
Forum: C++ 15 Days Ago |
| Replies: 5 Views: 222 By binomial coefficient you mean finding the combinatorial number, is that right ? So you should be using the formula n!/(n-k)!*k!
for this the pseudocode should be
numerator=1*2*3..*n
fact1 =... |
Forum: Java 15 Days Ago |
| Replies: 4 Views: 303 [code=c++]
Just a suggestion: Don't you think this loop is a bit too nested? you could make your code much readable if you simplified these nested loops. |
Forum: Java Oct 24th, 2009 |
| Replies: 6 Views: 433 The null is because it's reading past the last line of the file. So when it has read the last line the 'while' is true, then it reads the next line(one after last one) then when you access the length... |
Forum: Java Oct 22nd, 2009 |
| Replies: 6 Views: 433 upload the data files if they are not too big, we'll see if we can help. |
Forum: Java Oct 21st, 2009 |
| Replies: 6 Views: 433 'tmp' string might be null. put a check like this after you do the 'readLine' and try
if(tmp != null)
{
//your code
} |
Forum: C++ Jul 15th, 2009 |
| Replies: 4 Views: 426 Is this the exact code you compiled? And is that the only error you got? Your code has a lot of other compiler errors too as of now. It'll be good if you paste the entire code after you remove all... |
Forum: C++ Jul 13th, 2009 |
| Replies: 4 Views: 338 you need to pass the reference to the pointer to make it work. You are just modifying the copy of the pointer here. So the changes will not be visible once you leave the fn.
fn signature could be... |
Forum: C++ Jul 1st, 2009 |
| Replies: 3 Views: 417 If you are compiling them one-by-one make sure you only compile and don't go to the linking process. I think you might be doing that and while trying to create an executable its not finding main.... |
Forum: C++ Jun 29th, 2009 |
| Replies: 13 Views: 577 Why don't you post the problem statement first. Then explain how you are trying to achieve it in your code. Then as I said, read about data-types. how did you find out about c_str fn? And I posted... |
Forum: C++ Jun 29th, 2009 |
| Replies: 13 Views: 577 Hmmm.. don't know where to start from. First things first, 'num' is of type 'char', do you have a class 'char' which has a fn c_str defined? No. Its a fn of the 'string' class. Then you didn't even... |
Forum: C++ Jun 29th, 2009 |
| Replies: 13 Views: 577 1->atoi signature is this:
int atoi ( const char * str );
2-> read some more threads here to find out alternatives to atoi. You should avoid using it. |
Forum: C++ Jun 26th, 2009 |
| Replies: 6 Views: 439 Well i copied your class, created a class definition out of whatever was given and used it and it worked fine for me.
#include <iostream>
#include <fstream>
#include <string>
class... |
Forum: C++ Apr 20th, 2009 |
| Replies: 6 Views: 381 My bad, i didn't see the function signature properly, you're returning by value so the copy ctor will get called.
that doesn't seem to be so because
maxItems = sB.maxItems;
and hence... |
Forum: C++ Apr 20th, 2009 |
| Replies: 6 Views: 381 If you are passing the address of result then it's definitely a problem because you have not allocated 'result' on the heap. It's a local variable in the function Union and it disappears when we exit... |
Forum: C++ Feb 27th, 2009 |
| Replies: 32 Views: 1,561 unfortunately then it would fail to evaluate his original expression of
264+* ...right? |
Forum: C++ Feb 6th, 2009 |
| Replies: 6 Views: 396 Not allowed to use the <string> header? |
Forum: C++ Feb 4th, 2009 |
| Replies: 11 Views: 879 It worked for me without any problems. |
Forum: C Feb 4th, 2009 |
| Replies: 4 Views: 1,193 malloc returns a void* to the memory allocated and you need to ensure that you type cast it to the correct type. |
Forum: C++ Jan 29th, 2009 |
| Replies: 4 Views: 292 There's a post at the top of the forum Read This before posting (http://www.daniweb.com/forums/thread78223.html). It talks about using code tags and posting well indented and easy to read code.... |
Forum: C++ Jan 29th, 2009 |
| Replies: 3 Views: 789 I think the problem is that you are not setting the 'next' pointer of the last node to NULL. It cab be containing some garbage and giving unexpected results. Can you try this.
void... |
Forum: C++ Jan 23rd, 2009 |
| Replies: 2 Views: 440 for(j=0;j<5;j++)
{
cout<<"The name List\n"<<name<<"\n";
}
somehow i didn't feel like replying because it seems like you didn't try to debug this on your own even once before shooting... |
Forum: C++ Jan 23rd, 2009 |
| Replies: 8 Views: 677 and you can change 'ofsteam' to 'ofstream' if its like that in your original code too. |
Forum: C++ Jan 23rd, 2009 |
| Replies: 5 Views: 338 Why don't you write a test program to check it? |
Forum: C++ Jan 21st, 2009 |
| Replies: 8 Views: 1,248 you can use the istringstream class and convert string to int
string a = "byebye";
istringstream s(a);
int i = 0;
s>>i
... |
Forum: C++ Jan 21st, 2009 |
| Replies: 9 Views: 327 I would say you can use the following algorithm
1> convert both the arrays to all upper case or all lower case
2> sort both the arrays
3> compare the contents
4> at first mismatch print 'its... |
Forum: C++ Jan 21st, 2009 |
| Replies: 9 Views: 327 >It will then store the alphabetical character into an array ignoring all other character
>compare to see if they have the same alphabetical characters in there.
so first you fetch the alphabets... |
Forum: C++ Jan 21st, 2009 |
| Replies: 9 Views: 327 >it is not giving me the right answer
and what is the right answer?? what is the program supposed to be doing?? The header doesn't say what it does and i don't want to check the code to find that... |
Forum: C++ Jan 20th, 2009 |
| Replies: 1 Views: 236 for a 2-dim char array values can be extracted like
char *a[] = {"tom","som"};
cout << a[0] << " " << a[1] << endl; |
Forum: C++ Jan 17th, 2009 |
| Replies: 26 Views: 1,132 where's the code for TestAccount.cpp? |
Forum: C++ Jan 17th, 2009 |
| Replies: 26 Views: 1,132 well when you create the object of the child class the base class ctor gets called and since you have declared your own ctor the compiler doesn't give you a default ctor. In the definition of the... |
Forum: C++ Jan 12th, 2009 |
| Replies: 3 Views: 1,238 1> i dont know if this will work(i mean the vector thing, not struct way). but assuming it does,
one issue i see with using a vector is if you have to verify that a particular point is on the right... |
Forum: C++ Dec 26th, 2008 |
| Replies: 15 Views: 2,745 Header required for 'TButton' is missing i think. |
Forum: C++ Dec 16th, 2008 |
| Replies: 6 Views: 596 Can you rephrase your question? i can understand it in parts but its not very clear what you have and what you want to do. |
Forum: C++ Dec 9th, 2008 |
| Replies: 7 Views: 397 like i pointed out in the thread below this, where are you assigning anything to 'Applicant item;', ok so you changed it from a pointer to an object but where are the values? the 'app' object you... |
Forum: C++ Dec 4th, 2008 |
| Replies: 4 Views: 390 and the errors are?? ..... |
Forum: C++ Dec 2nd, 2008 |
| Replies: 18 Views: 1,198 for(i = 0 ; *Src!='\0' ; Src++)
tmp[i]=*Src;
should increment 'i' also. as of now 'i' remains 0 throughout. |
Forum: C++ Dec 2nd, 2008 |
| Replies: 18 Views: 1,198 OK.. my bad... True .. it will not work. |
Forum: C++ Dec 2nd, 2008 |
| Replies: 18 Views: 1,198 I thought you could always assign a char* to another char*. Are you sure that declaring
char* string1 = "Bigger than String2";
wont work? |