Forum: C++ 8 Days Ago |
| Replies: 8 Views: 298 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++ 8 Days Ago |
| Replies: 8 Views: 298 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++ 19 Days Ago |
| Replies: 5 Views: 241 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: C++ Jul 15th, 2009 |
| Replies: 4 Views: 441 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: 340 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: 432 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: 582 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: 582 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: 582 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: 442 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: 383 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: 383 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,595 unfortunately then it would fail to evaluate his original expression of
264+* ...right? |
Forum: C++ Feb 6th, 2009 |
| Replies: 6 Views: 397 Not allowed to use the <string> header? |
Forum: C++ Feb 4th, 2009 |
| Replies: 11 Views: 885 It worked for me without any problems. |
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: 791 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: 442 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: 682 and you can change 'ofsteam' to 'ofstream' if its like that in your original code too. |
Forum: C++ Jan 23rd, 2009 |
| Replies: 5 Views: 339 Why don't you write a test program to check it? |
Forum: C++ Jan 21st, 2009 |
| Replies: 8 Views: 1,276 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: 329 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: 329 >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: 329 >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: 237 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,137 where's the code for TestAccount.cpp? |
Forum: C++ Jan 17th, 2009 |
| Replies: 26 Views: 1,137 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,248 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,779 Header required for 'TButton' is missing i think. |
Forum: C++ Dec 16th, 2008 |
| Replies: 6 Views: 598 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: 398 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: 391 and the errors are?? ..... |
Forum: C++ Dec 2nd, 2008 |
| Replies: 18 Views: 1,205 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,205 OK.. my bad... True .. it will not work. |
Forum: C++ Dec 2nd, 2008 |
| Replies: 18 Views: 1,205 I thought you could always assign a char* to another char*. Are you sure that declaring
char* string1 = "Bigger than String2";
wont work? |
Forum: C++ Nov 28th, 2008 |
| Replies: 10 Views: 746 How do you know its not opening the file? is it printing 'File not found' ?? Why dont you try and read something from the file and confirm? |
Forum: C++ Nov 28th, 2008 |
| Replies: 10 Views: 746 if its printing 'Hello.' then it has executed the switch statement.. |
Forum: C++ Nov 28th, 2008 |
| Replies: 10 Views: 746 I don't see a problem at all. The only reason could be (assuming that the file is very much present in the same directory where you are executing this code) is that you might entering 'h' instead of... |
Forum: C++ Nov 25th, 2008 |
| Replies: 7 Views: 3,528 read here (http://msdn.microsoft.com/en-us/library/36k2cdd4(VS.80).aspx) |
Forum: C++ Nov 25th, 2008 |
| Replies: 7 Views: 3,528 i thought it was 'Testnamespaces.h' .. anyways is the path of the file available in your include path? -I option of the compiler? is this file actually present in the path, did you confirm? if you're... |