6,741 Posted Topics

Member Avatar for nkhosinathie

>then how can i force the user to enter the righr information I'll assume you mean forcing them to choose one of the selected options. ;) You do that with validation. After the choice is entered, you make sure that it matches one of the options and if it doesn't, …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for afflictedd2

No, associative containers don't support setting the capacity without explicitly adding a range of items. >I have to map this in shared memory That's not an issue. The map object itself has a fixed size because it uses dynamic memory by default for the items. Provided you share the structure …

Member Avatar for vijayan121
0
119
Member Avatar for fatnickc

So...basically you're writing a heap, right? >The part I am facing trouble with is doing the actual swap, as 'parent' is only a pointer to the node's parent. Are you swapping data or doing a physical swap? If you're swapping data, I don't see what the problem is. If you're …

Member Avatar for fatnickc
0
241
Member Avatar for muzammilpn

>It's pretty simple first create a binary tree, then read the input and insert >each element in appropriate place in teh tree, then read it back in postfix notation. Brilliant. :)

Member Avatar for iamthwee
0
140
Member Avatar for rashmi43

>Without changing the main function modify the following code so that the o/p is Okay, done. Show me yours and I'll show you mine.

Member Avatar for Narue
0
91
Member Avatar for IwalkAlone

>return ptr[0]=ptr[length-1]; You always return here, so the two lines after this can never run. >while(*ptr!='\0') If you have a loop in a simple recursive function, it's probably wrong. Remember that you're using the recursion to hit each element in the array, so that loop should be changed to an …

Member Avatar for ~s.o.s~
0
143
Member Avatar for Zay

This is a special operation that can't easily be done using just the basic queue operations. So you should make it a non-member friend function and sort the internal storage structure.

Member Avatar for Narue
0
1K
Member Avatar for CRD

Ugh. If you don't know why that's ugh, you shouldn't be using it. Try this instead: [code] #include <iostream> int main() { std::cout<<"Hello, world!\n"; } [/code]

Member Avatar for CRD
0
80
Member Avatar for IwalkAlone

>when it is necessary to include a return statemnt in one's code When you're returning from any function whose return type is not void. >what is the difference between recursion and iteration? At what level? At the highest level, there's no difference. Go a bit lower and recursion is just …

Member Avatar for IwalkAlone
0
143
Member Avatar for christina>you

>This was sent to me today... You fall for a lot of scams and hoaxes, don't you?

Member Avatar for 'Stein
0
559
Member Avatar for ghadahelal
Re: hex

>that's c not c++ sprintf is C++ too. >do u know anyother sol. in c++ Yes, use the hex manipulator with either cout or a string stream. Alternatively, you can do the conversion manually, but since that's available in C as well, I guess it doesn't count as C++. :icon_rolleyes:

Member Avatar for WaltP
0
218
Member Avatar for ghadahelal

>but when i tried 2 open it , it doesn't work. You're reading from a binary oriented file stream but writing to a text oriented file stream. Most likely you want to open the output stream as binary also. And please don't use chatty abbreviations. We have a rule against …

Member Avatar for ghadahelal
0
110
Member Avatar for kissiwat

>>>fflush (0); >That is non-standard No, it's well defined by the standard. If the argument is a null pointer, all open output streams are flushed.

Member Avatar for Ancient Dragon
0
183
Member Avatar for Tauren

>I just have a question is the book C++ Programming Primer By D.S. Malik a book worth getting? You can get it on Amazon for less than $5, so it's not something you have to think too hard about. If it's a bad book, not much is lost. If it's …

Member Avatar for Narue
0
267
Member Avatar for MarzenaM
Member Avatar for WaltP
0
255
Member Avatar for laconstantine

>I just was wondering why the array its self are a pointer to the first element? Because it was a design decision by the language creator. >and what is the difference between an array and a pointer? An array is a collection of objects, and a pointer is a variable …

Member Avatar for newprog
0
233
Member Avatar for christina>you

It hides the content of posts (which you can see by clicking a link), but not the fact that a post was made. I don't believe it blocks PMs or rep. All in all, I think the ignore feature is worthless. You're basically hiding posts when if you really have …

Member Avatar for 'Stein
0
161
Member Avatar for m3an
Member Avatar for m3an
0
149
Member Avatar for Duki

It depends on what you're looking for. Perhaps the post shown in the tooltip could show the first post based on your thread display options? If you use linear with oldest first, it would show the first post, and linear with newest first would show the most recent. I don't …

Member Avatar for Ancient Dragon
0
109
Member Avatar for Dave Sinkula

The default because I type code tags manually and I'm too lazy to add the language. And yes, I'd prefer a box as it clearly separates two different code blocks without having to add text between them. Why do you ask?

Member Avatar for Dani
0
198
Member Avatar for kylcrow

A good entry level job will give you a lot of exposure to existing code and the people who wrote it. That way you can read code, maintain code, and learn from more experienced programmers. A good entry level job will also put you in a position to watch and …

Member Avatar for kylcrow
0
95
Member Avatar for jaepi

>so, if you will check if the input is a number or not, what is the appropriate function to use??? You're using formatted input, so you just need to check the error state of the stream object: [code] if( !( cin>> temp2 ) ) { cout << "not a number …

Member Avatar for thekashyap
0
118
Member Avatar for brightmohan

>Why should it run Perfect under windows?? Pure luck. >Why the ruckuss in Linux? The problem is here: [code] strcpy([COLOR="Red"]str1[/COLOR],cat[b].lname);//flagged strcpy([COLOR="Red"]str2[/COLOR],cat[b].fname); strcpy([COLOR="Red"]str3[/COLOR],cat[b].title); [/code] str1, str2, and str3 don't point to anywhere predictable, and certainly not to arrays (that you own) large enough to hold the strings your copying into them. …

Member Avatar for Salem
0
101
Member Avatar for kylcrow

You need to know how long the string is, and how wide the available field space is. Then take the difference of that and if it's greater than 0, prepend that number of spaces onto the string: [code] #include <iostream> #include <iomanip> #include <string> std::string right_justify ( const std::string& s, …

Member Avatar for Narue
0
144
Member Avatar for nkhosinathie

>my question is i want help to develop a pseudocode for this program before i can compile it That's not a question, it's begging for code. It doesn't matter if the code is pseudocode or C code. It's still code that represents a solution that [b]you[/b] are supposed to figure …

Member Avatar for Aia
0
135
Member Avatar for The Dude

What an incredibly biased test. It's immediately obvious what kind of "Emotional IQ" they're trying to force you to have. :icon_rolleyes:

Member Avatar for jbennet
0
93
Member Avatar for nkhosinathie
Member Avatar for Narue

I've noticed a need for this both as a mortal and as a mod. If I could set up a list of "people to watch" that would show me the same information as the currently active users list except with only those people, that would be stellar! :) On a …

Member Avatar for Dsiembab
0
150
Member Avatar for ollie335

>num[a] = num[a] = '0'; = is not the same as -. One is assignment, the other is subtraction. This is the line you want that will give you the correct sum: [code] num[a] = num[a] [B][I][COLOR="Red"]-[/COLOR][/I][/B] '0'; [/code]

Member Avatar for ollie335
0
89
Member Avatar for snedan

>DataFile.open(fileName, ios::out | ios::app); [code] DataFile.open(fileName.c_str(), ios::out | ios::app); [/code] The open member function takes a C-style string.

Member Avatar for Narue
0
90
Member Avatar for iTaChi

>Is there anyway i can learn system programming in C? Probably. >What site would you recommend?? I wouldn't. I would recommend a few books depending on the OS you plan to work with.

Member Avatar for iTaChi
0
136
Member Avatar for AWDracer
Member Avatar for kylcrow

>Does it have something to do with how I got scores? It probably has something to do with returning an int from a function that's defined to return a string... Also, your function probably doesn't do what you want. Can you describe what you think it should be doing?

Member Avatar for vijayan121
0
143
Member Avatar for satyanarayanam

>This will work in C++ wht abt c? No, it won't work in either because you can't call a function at global scope. It also fails to meet the requirements because you try to use printf. :icon_rolleyes: >HOW sizeof() implemented in C means Sourrce code? You can't do it portably. …

Member Avatar for vijayan121
0
134
Member Avatar for Narue

[B][U]Before You Ask[/U][/B] [list=1] [*][B]Engage your brain![/B] We understand that running into a problem can turn off the rational centers of the brain, but please sit back and think for a bit about your problem before running off to find help. All too often a little common sense is all …

19
3K
Member Avatar for jaepi

>i just want to know how to compare a string to null You don't. NULL is a null pointer and a string object isn't a pointer. Most likely you want to check for an empty string: [code] if ( x == "" ) [/code] or [code] if ( x.empty() ) …

Member Avatar for ~s.o.s~
0
9K
Member Avatar for kylcrow
Member Avatar for caltiger

>- use inline functions (new compilers do this implicitly though) The compiler is in a better position to know what functions are best inlined. An explicit inline keyword strikes me as akin to the register keyword in premature optimization. >- use registers. Speaking of the register keyword, don't waste your …

Member Avatar for Narue
0
191
Member Avatar for Zay

If you actually formatted your code intelligently, this error would be obvious. Here's the same code with better formatting. I've pointed out the error in red: [code] template <class Type> int isPalindrome (Type * word) { stackType <Type> mystack; int i=0,count=0; while(word[i]!=NULL) { count++; i++; } int half=count/2; for(int j=0;j<half;j++) …

Member Avatar for Zay
0
136
Member Avatar for Aia
Member Avatar for Aia
-1
512
Member Avatar for NewKidWalking

>There is some syntax of cin that allowes us to ignore the \ns.. Isn't it? You're probably thinking of the ws manipulator, but it discards [I]all[/I] whitespace. If you want more control, you have to write your own manipulator: [code] class scan { public: scan ( const char *init ): …

Member Avatar for iTaChi
0
133
Member Avatar for fastcarz3

Perhaps you should ask your question with a new thread in the VB forum instead of resurrecting a [B]four year old[/B] C++ thread. kthnxbye.

Member Avatar for nkhosinathie
0
368
Member Avatar for nkhosinathie

I imagine the problem was designed to force you to use a recursive solution. That's really the only way to loop without using a loop.

Member Avatar for Narue
0
111
Member Avatar for MAI&

>cuz i did it in the most retarded way ever Not really. You're on the right path. You need to split up the data entry and printing parts. They can both be written using a simple nested loop for a two dimensional array: [code] // Read the student's grades for …

Member Avatar for Narue
0
103
Member Avatar for algo_man

>What is the size of an activation record for the function f()? It depends on the compiler and there's really no reason for you to care in client code. >How did you find out? Experience and knowledge of the C standard.

Member Avatar for Narue
0
102
Member Avatar for ndeniche

I don't mind striking the point home, but if this turns into a whine thread, I'll either have to unsticky it and start my own, or get out the mod stick.

Member Avatar for nkhosinathie
1
288
Member Avatar for ak_2005

I'm constantly amazed how people use an ancient compiler with an obsolete graphics library and expect it to work seamlessly with the latest operating system...

Member Avatar for ~s.o.s~
0
782
Member Avatar for ibrar_niitian

So what's your question? Posting nothing but a homework problem suggests that you want us to do it for you, which isn't going to happen. We require effort on your part before we'll offer any help.

Member Avatar for Narue
0
110
Member Avatar for phalaris_trip

>that's the real art of programming, isn't it? Not really. The real art of programming is solving the problem without creating an unruly mess. You can learn the names and memorize the code for a thousand algorithms and still be completely incompetent. >I guess it comes with experience, but most …

Member Avatar for Rashakil Fol
0
116
Member Avatar for tony71

>I did the changes but still having issues. It would be nice if you told us what those issues were. :icon_rolleyes: >cout endl; That won't compile. You probably meant [inlinecode]cout<<endl;[/inlinecode]. >grade= ((10- (grade/10)) + 64); grade doesn't have a predictable value but you use it in an expression...

Member Avatar for tony71
0
131

The End.