Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>NB: I'm sorry if I haven't followed all the forum's posting rules. It's my first time and I've done it to the best of my understanding

You did ok -- at least you tried which is more than many do. :)

I'm not able to help you out because I don't have that compiler.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

any reason to resurrect this 3-year-old thread?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

None of those certifications are worth the paper they are written on because people can just read the book and pass the tests with no experience. That makes the certifications worthless. Experience is what really counts.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

now that you have posted all that code, what, if anything, is your question?

iamthwee commented: better use of adding and INDENTING with code tags. +9
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

if we spend this much time for maintenance then when will develope new product...

software companies hire more programmers and is one reason for such a high demand for programmers. And is a reason for compiler writers such as Microsoft to invest a lot of $$$ in R&D (Research and Development) of new and improved IDE and compilers. Finally it is a reason for the huge demand for 3d party libraries and toolboxes -- to reduce program maintenance time and costs.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

is there any difference between [ code=c ] and [ code=cplusplus ] ? I don't see the difference except, of course, the title. If no other difference why do we need both of them ?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I just tried it and it was ok -- If it persists for you please report it to Dani so that she can fix it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Sorry, the proper c tagging is not working at this time.

would you please explain what you mean by that? you can use [ code=c ] if you want to see line numbers, but I assume you already know that. If something is broken maybe you should start a thread in DaniWeb Community Feedback.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The result does not have decimals because 9 and 5 are both integers and 9/5 returns an integer. you are typcasting the result of the division which is 1 to a float. Read Salem's example for the correct way to do what you are attempting, unless you want to get really brillent and appear to be super-smart and do something like this: :cool:

celsius*static_cast<float>(static_cast<float>(9)/static_cast<float>(5))
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

the parameters to main() can be in one of two forms

int main(int argc, char **argv)
{
}

or
int main(int argc, char *argv[])
{
}

Both the above are identical and access individual arguments the same way. Convert the third argument like this (recall argv[0] is the name of the program).

int main(int argc, char **argv)
{
   int n = atoi(argv[2]);
}

There are several functions that convert a string to int or long and all are normally acceptable, atoi() is only one of them. atoi() does not provide for any error checking, so if you are concerned about possible errors in the argument string then you should use one of the other functions.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Sometimes I mark them solved if the OP clearly indicates he has received the help he was looking for. Otherwise I let it go because I don't know if its solved or not. And I don't normally bother to read threads that have not had any posts for over a couple days or so. I don't think its worth the effort or my time to read through a bunch of old threads just to see if I can mark them solved.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

We have ration for document and development. but we dnt hv any ratio for development and maintenance. As per my knowledge we cant define any ratio for this.

And neither can anyone else. I have been developing for over 25 years and Narue is right -- if you want a rule-of-thumb, or guestimate, then 1:60 (one minute development to 1 hour maintenance) is a reasonable one. Where I work we wrote a program 5 years ago and have been maintaining it every since because the customer keeps changing requirements and updating the hardware the program runs on. Its ok for us because we made tons of money on it and continue to do so every time the customer adds new requirements of changes existing ones, but that beside the point.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Google is your friend -- al you need is a font editor and you can create all the fonts (or even edit existing ones)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Some movement has been recently introduced into congress that gives DC people voting rights.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

i'm absolutely confused...

Then you should probably re-read and re-study your text book and practice the exercises at the end of each chapter until the concepts have a chance to sink into your brain. No point in attempting to write a program if you have no clue how to do it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't think DC was originally intended to be the big city that it is today -- it was supposed to be a place for our nation's capital that was not in any state so that it could be more impartial. People who live there today do so by choice -- nobody is making them stay there. If they want representation then move to one of the 50 states.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I think you people have been watching too much Outer Limits ;) Dark matter exists only in your imagination.

Aia commented: LOL +2
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't think any of them fit me. Would like to think #11 does, but it doesn't. I voted before taking the test -- can I change my vote now :'(

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Also once in college you might be able to shorten your time there by taking bypass tests to get credit for the material you already know. No point in being bored in class listening to elementry stuff you have already studied.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

A common problem is to write a class called Animal and use it to derive two more classes called Cat and Dog. class Animal has a pure virtual method called Speak that is implemented in Cat and Dog to either meow or bark.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Its a republic isnt it?

Thankfully the founding fothers had the forseight to make it a republic. They took what they liked about UK and France then made up the rest. You do realize, though, that they were just a bunch of rebels and criminals of their day, or at least according to the King of England. It wasn't until just a few years ago that Queen Elizabeth gave us our freedom. :D

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

maybe a dumb question, but why use putback() at all? Why not just use the seek functions to move the file pointer to where-ever you want it? I would suspect putback() just calls seek to move the file pointer back one char in the buffer.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here's something that one of our founding fathers said. I thought it was interesting. It was John Adams.

"Remember, democracy never lasts long. It soon wastes, exhausts, and murders itself. There never was a democracy yet that did not commit suicide."

Its a good thing the USA is not a democracy:*

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

my guess is that the '\n' (<enter> ) needs to be flushed out of the keyboard after entering a number. you can use getchar() to do that. Example: call getchar() after line 20 to remove the '\n' from the keyboard buffer.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I only hate the really dumb ones like we see once-in-awhile in the C/C++ boards. I normally don't bother reading such threads except to check to see if it violates any DaniWeb rules. But for Geeks Lounge they're ok for people who like to participage in them.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

me -- I'm just too lazy to answer them. Almost didn't answer this one either for the same reason. :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>> Anyone know why?
maybe your hand got used to the temperature??? Or maybe it just needed a break-in period.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I recall watching an episode of "Myth Busters" awhile back where they attempted to prove or disprove the myth about cell phones causing gas stations to blow up. They made many attempts and all failed.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Illegal -- probably not. But it depends on the policy of the company (Best Buy in your example). I'm pretty certain they will put a stop to that real quick if and when they find out about it. Its not worth it to lose your job over a few quick bucks. And you will also tarnish your reputation so that other similar companies will probably not hire you for the same reason you got fired from Best Buy. It may be legal but its a stupid thing to do.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Just in case anyone is interested here is the corrected sorting algorithm in the link in the original post. It had several bugs that I fixed and sent to the admins of that site too. It sorts an linked list of integers. If you want it to sort something else, such as floats or structures you will have to make appropriate changes to the quicksort() function.

I'm not vouching for its efficiency -- there may be more efficient ways of doing it. Only saying here that it works.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct Node Node;


struct Node
{
  void* info; //data
  Node* next; //used to point to next node
};


//this implementation doesn't use any explicit special header node
//one has to maintain a start point of a list to track all other nodes
//so createlist is a dummy one
Node *createlist()
{
  return NULL;
}

//insert after a known node and return the node before inserted node
Node *insert(Node *after, long* data)
{
  Node* n;
  n = malloc (sizeof(Node));
  n->info = data;

  //incase header node is not created
  if (!after)
  {
    n->next = after;
    return n;
  }

  n->next = after->next;
  after->next = n;

  return after;
}

void destroylist(Node **n)
{
  Node * tmp;

  if (!n || !*n)
  {
    return;
  }

  while(*n)
  {
    tmp = (*n)->next;  
    free(*n);
    *n = tmp;
  }
}


//given a node in list, prints entire list after the node
int printlist(Node *h)
{
  Node* t = h;

  while(t)
  {
    printf(" %d …
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

And it gets a little more complicated because there are *nix compilers that have been ported to MS-Windows os, and consequently still use *.a library extensions. Dev-C++ is one such compiler. So for libraries the extension depends on the compiler.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here is a simple example of a union

union items
{
    short apples;
    long  oranges;
    float  amount;
};

your program, not the compiler, is responsible for making sure the items in the union are referenced correctly. If you instantiate an object of type items and set amount to something, then that object should always reference amount and not one of the other union members. The compiler will not complain if you do, but it will result in unexpected behavior. You can, of course, assign one of the other values a value and use that member variable from then on.

Some unions I have worked with are inside another structure that the structure contains an int that indicates which union member is in use.

const int UNDEFINED_VALUE = 0;
const int APPLES_VALUE = 1;
const int ORGANGES_VALUE = 2;
const int AMOUNT_VALUE = 3;
struct items
{
    int    n;
    union 
    {
        short apples;
        long  oranges;
        float  amount;
    };
};

In the above n would be one of the four const values shown above and the program would always know which union member is active at the time it is referenced.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

lines 17, 18 and 19. you need to add '{' after line 17 and '}' before line 20. That will fix the first two error messages you got.

>>3. parameter fibo is never beeb use?
That is telling you that the function has a parameter that is not used inside the function. Many compilers complain about such things. The way to remove the error is to either add something inside the function that references the parameter or remove the parameter.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

remove the semicolon at line 13

>>e.g i input number 5,the fibonacci value of 5 is 3(right)

Not unless you made a typo. The Fibonacci number is the sum of the two previous numbers in the sequence. such as 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89.

>>but it dispaly 1258????
The code you posted doesn't display anything. In fact, it doesn't even call the fibonacci function.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

can someone give idea how to get compilrrs free or by payingfor cpp

If you use MS-Windows operating system you can get Dev-C++ from www.bloodshed.net. Otherwise if you use *nix you can get gcc and g++ from www.gnu.org. Both are free.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

delete line 13, it has no purpose.

change line 25 to use pointer pS

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I agree with The Dude -- Wow :cool:

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

One afternoon, a lawyer was riding in his limousine when he saw two men along the roadside eating grass. Disturbed, he ordered his driver to stop and he got out to investigate.

He asked one man, "Why are you eating grass?"

"We don't have any money for food," the poor man replied. "We have to eat grass."

"Well, then, you can come with me to my house and I'll feed you," the lawyer said.

"But sir, I have a wife and two children with me. They are over there, under that tree."

"Bring them along," the lawyer replied.

Turning to the other poor man he stated, "You come with us, also."

The second man, in a pitiful voice, then said, "But sir, I also have a wife and SIX children with me!"

"Bring them all, as well," the lawyer answered.

They all entered the car, which was no easy task, even for a car as large as the limousine was.

Once underway, one of the poor fellows turned to the lawyer and said, "Sir, you are too kind. Thank you for taking all of us with you."

The lawyer replied, "Glad to do it. You'll really love my place............

The grass is almost a foot high."

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Of course we can. What is your question(s) ?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you want to save to a file why are you using an input file ifstream? All you need is the output file ofstream, something like this:

ofstream outdata("PayrollTaxes.txt");
<snip>
outdata << left << setw (22) << "Federal Tax " << right << setw(14) << federal << "\n";

>>also I am not sure how to get the money sign in front of the amount.

Easy -- just Shift+4 key on an American keyboard. If you have a UK keyboard them you would probably want to use the pound key (I don't have that key on my keyboard)

outdata << ".... $" << amount.
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The more I look at this code the less I like it -- even after fixing all compile errors the code does not work. The linked list before and after sorting are identical. The author obviously failed to compile and test this program before posting it, and he should be ashamed of himself for doing that. You would be better off not using that program.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I downloaded the source and tried to compile as a C program using Visual C++ 2005 Express. Lots of compile errors, probably all of them are solvable if you are alreay comfortable with C language. Don't expect to use that code as-is -- you will have to make code changes and add at least one undefined function.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Looks like some confusion of terminology -- I assume the term system call means an api function, not the system() function. The system() function does as ~S.O.S~ said in his post. But most os api functions are implemented as library functions as previously mentioned also.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you need to write a win32 program that hooks into the keyboard. See SetWindowsHookEx function in MSDN

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Most system calls are also library functions because the compiler needs the libraries in order to resolve functions at link time. There are a few exceptions, but very rare.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

yes, I think you have the right idea. The prototype might look something like this:

void foo(int* prm1, int* prm2, int* prm3);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

edit: eh, sorry for double posting. Is there no way to delete posts on this forum?

Yes, ask and thy wish might be granted.:)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you can use popen to create a pipe between your program and the other executable. Output of that other program will can be read by your program via the pipe.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Your program should probably call UpdateWindow() to force the WM_PAINT message to be put into the message queue. Have you read MSDN OnPaint description?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

does parse() modify the contents of the char array in the first argument to the function ? If it does, then maybe the parse function is overrunning that buffer.