Forum: C++ 7 Days Ago |
| Replies: 7 Views: 200 The if-else is redundant;
A number which is smaller than 10, when undergoes modulus operator with divisor as 10 will yeild that number itself.
7%10=7
1%10=1 and so on...
Your reverse function... |
Forum: C++ 23 Days Ago |
| Replies: 6 Views: 258 Well, I remember I ran into a problem when I needed to install MinGW on a machine with no Internet Connection.
So here is what I did: I downloaded the Codeblocks setup from the website: the one... |
Forum: C++ Oct 6th, 2009 |
| Replies: 6 Views: 237 Did you tried it?
Hint: Yes, you are on the right path. Just go on... ;) |
Forum: C++ Oct 5th, 2009 |
| Replies: 4 Views: 319 >how to use isalpha to chech for a character
Check the reference (http://www.cplusplus.com/reference/clibrary/cctype/isalpha/).
Next time, if you intent to ask a C-related question, check out the... |
Forum: C++ Oct 5th, 2009 |
| Replies: 6 Views: 237 Learning from examples is a great way to understand things; only if you understand the example completely before trying to fit your crude analogies.
And when you are not able to construct a basic... |
Forum: C++ Sep 30th, 2009 |
| Replies: 4 Views: 370 If at all you want to throw string literals, remember that they are const char* not simply char*. So refactor your code as:
void Xhandler(int test)
{
try
{
if (test) throw test;... |
Forum: C++ Sep 30th, 2009 |
| Replies: 12 Views: 385 >How do I give out Rep on this site?
What is 'Rep'.
If you mean reputation, can just click on the "Add to <username> Reputation" on the post for which you want to repute the user. Choose "I ... |
Forum: C++ Sep 30th, 2009 |
| Replies: 5 Views: 277 Uh good. But I think you realised your limitation.
For sorting integers, there are many algorithm available (http://en.wikipedia.org/wiki/Sorting_algorithm#Summaries_of_popular_sorting_algorithms).... |
Forum: C++ Sep 30th, 2009 |
| Replies: 2 Views: 278 stringstreams (http://www.cplusplus.com/reference/iostream/stringstream/) are often useful when you want to parse a sting input, specially when you need to do something with words.
So make a... |
Forum: C++ Sep 30th, 2009 |
| Replies: 12 Views: 385 Looks like you are trying to loop some statements. But the syntax of the loop is not correct. Read http://www.cplusplus.com/doc/tutorial/control/ (Loops) to find out the correct format. |
Forum: C++ Sep 30th, 2009 |
| Replies: 2 Views: 177 Use a std::map (http://www.cplusplus.com/reference/stl/map/).
Create a map<std::string, int>.
Scan through the file and insert each of the word to the map with initial value 1. If the word already... |
Forum: C++ Sep 30th, 2009 |
| Replies: 11 Views: 324 >Its c++, is there anything cute about it?
Yes. I find std::strings , std::vectors very cute. I have a less of headache when I use these (provided I am not concerned so much about the program... |
Forum: C++ Sep 29th, 2009 |
| Replies: 11 Views: 291 Consider the parenthesised version of the OP's code:
double ExprTree::evaluate(TNode* p) const
{ //this is the first if
if( p->data == "+" ||
p->data == "-" ||
p->data == "*" ||... |
Forum: C++ Sep 29th, 2009 |
| Replies: 11 Views: 324 >but also i guess "cin" might be intelligent enough to know whether the input is valid or
>not
cin is intelligent enough that it won't at least calmly accept a invalid input. But when the input... |
Forum: C++ Sep 27th, 2009 |
| Replies: 8 Views: 340 >>nope.can you help me solve my problem??please...
>>hey there FirstPerson.I m new with c++ so i think i m zero with it.can you help me
>>with my problem??
>>As you know firstPerson i m new... |
Forum: C++ Sep 25th, 2009 |
| Replies: 11 Views: 324 >U dont need to validate them like that.
Actually he needs to. If the user enters any non-numeric character, his program can hang, halt, break or whatever. The worst part is, that the programmer... |
Forum: C++ Sep 25th, 2009 |
| Replies: 4 Views: 193 Get some sand and clay. Try to first model desks and benches. Then model teacher and students. And your class is ready. |
Forum: C++ Sep 24th, 2009 |
| Replies: 6 Views: 258 This is called explicit template instantiation.
Read http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12 |
Forum: C++ Sep 23rd, 2009 |
| Replies: 6 Views: 258 >>little ugly
Is it?
This is the correct way to the thing what you want.
You create a class template when you want to separate the implementation of the whole class according to the template... |
Forum: C++ Sep 23rd, 2009 |
| Replies: 6 Views: 362 >can u plz explain that when is the order of precedense will be right to left?
Are you deaf?
Look at the post #2 and try to accept that what ever niek has said is actually true.
Your program is... |
Forum: C++ Sep 2nd, 2009 |
| Replies: 9 Views: 369 >In your function, you allocate new memory for the array
>that is passed, which already has been allocated memory.
I suppose he has commented that line.
Hence technically, there are no memory... |
Forum: Python Aug 30th, 2009 |
| Replies: 11 Views: 881 I think one should always try to look at the date of the last post before replying to a thread no one is interested to read.
It is more than an year old. |
Forum: C++ Aug 30th, 2009 |
| Replies: 4 Views: 194 >Task:
>Write a program to grade a test and print the student’s score.
The task was given to you. You will be given grades for that.
You are redirecting the task to us, we won't get anything out... |
Forum: C++ Aug 29th, 2009 |
| Replies: 1 Views: 240 Its a project-euler.net problem No. 67 Right?
>My program for this program is not working
>can you please help.
Perhaps not. Seriously, I don't have enough time to spend and debug your code but I... |
Forum: C Aug 29th, 2009 |
| Replies: 8 Views: 474 >Got exam tomorrow
So you've been screwed.
Now did you remember when your instructor told you to read a text book?
>Anyone know that c program got wat type of error?
Yes... |
Forum: C Aug 29th, 2009 |
| Replies: 19 Views: 947 >1. Passing into a function and then into a sub-function.
Did you asked Google? Anyways, I did it for you: http://www-ee.eng.hawaii.edu/~dyun/ee160/Book/chap6/section2.1.2.html
>2. Passing 2d... |
Forum: C++ Aug 29th, 2009 |
| Replies: 3 Views: 296 Re-factor the simplify function which finally converts a/-b to -a/b. This will maintain uniformity and thus the program will be unambiguous. |
Forum: C Aug 29th, 2009 |
| Replies: 3 Views: 387 >You return a variable that ceases to exist after the function all (a
>variable local to the called function). Generally speaking, pass a
>pointer (to the start of the array) and then modify it... |
Forum: C++ Aug 29th, 2009 |
| Replies: 7 Views: 319 >Seriously? There's no options that do this for regular functions, the
>same way it can be done for the main function when it's handed
>command-line arguments? I thought it was possible to do
... |
Forum: C++ Aug 26th, 2009 |
| Replies: 5 Views: 200 >Recursive functions should be used as sparingly as possible as they
>are extremely slow
Yes. But looking at the other side of the coin, recursive function tend to be easy to model than iterative... |
Forum: C++ Aug 26th, 2009 |
| Replies: 5 Views: 200 >>write a recursive function to convert integer into string.
Your function will work good for all positive integer but would fail when N=0.
IntToString(0)="" |
Forum: C++ Aug 26th, 2009 |
| Replies: 1 Views: 235 >i'm a noob in C++ can any kind soul please help me
Not until you show any efforts.
Sorry.
Time out.
Best next article for you: http://www.daniweb.com/forums/announcement8-2.html |
Forum: C++ Aug 7th, 2009 |
| Replies: 6 Views: 382 >it's me 4101
Oh yeah! Even my real name is 312515473215781215487451 but I let them call me Siddhant so that they remember me. |
Forum: C++ Jul 20th, 2009 |
| Replies: 11 Views: 405 You really need to go down to the basics of inheritance - why we use it.
When you construct a base class, it is not really a base class but it is 'just a class'. It is when you use that class to... |
Forum: C++ Jul 20th, 2009 |
| Replies: 14 Views: 556 Have a close look on what are you doing.
In the loop at line 12, you read each line in one iteration to the std::string line.
Now you iterate a for loop nested inside the while loop and assign all... |
Forum: C++ Jul 19th, 2009 |
| Replies: 6 Views: 539 One suggestion would be to build a html parsing program and then perhaps connect to http://primes.utm.edu/lists/small/10000.txt and read out the list of primes into the memory and write them down to... |
Forum: C++ Jul 19th, 2009 |
| Replies: 14 Views: 556 >Any advice how to put each line in its own array element?
Not really but it would be better to apply brains and re-factor the code provided by twomers.
Declare an array of N std::strings and then... |
Forum: C++ Jul 19th, 2009 |
| Replies: 7 Views: 304 >I have not seen an 80-character width terminal in some 25+ years.
I have seen them neither since birth, But my text editor, my shell window, and best of all, daniwebs code tag formatter are all... |
Forum: C++ Jul 18th, 2009 |
| Replies: 7 Views: 304 Well, another "criticize my code" question. Good.
Here are my advices:
Try not to implement the code which has been provided to you by the standard library. This way you will make shorter and... |
Forum: IT Professionals' Lounge Jul 17th, 2009 |
| Replies: 22 Views: 1,107 Spoon boy: Do not try and correct void main. That's impossible. Instead... only try to realize the truth.
Neo: What truth?
Spoon boy: There is no void main.
Neo: There is no void main?
Spoon... |