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

But note that %i used by scanf() is different than %i used by printf(). For printf(), %i and %d are the same thing.

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

you will have to get it as a string, not a double, so that your program can check for extraneous characters, such as "...". If it passes that test then convert to double and check for negative value.

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

>>Anyway, VC++ is too big and Code::blocks is smaller

That might be a valid excuse if your hard drive is pretty full and you don't want to get a larger one. But Code::Blocks is only the IDE, you also need a compiler. VC++ 2008 is more than just a C/C++ compiler, it compiles CLR too, and its debugger is almost unbeatable by any other compiler/IDE.

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

binary files are called "binary" for a reason -- they contain the computer's internal representation of the data, not something us humans can easily read. When your program reads the binary file back into the structure, then print out the values (or view them with your debugger), you should see the same thing that you saw before the structures were written out to the binary file.

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

>>8000fe80 why this code is not working for this hexa decimal address
Data overflow.

On line 73 add cin.clear() to clear out the errors.

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

I have not had a problem with it. Tutorial here. Have you set the database up in the ODBC driver?

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

depends on the image files. If they are truly text, such as a scanned document, then you will need some sort of image recognition program.

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

>>so i decided that i'm fed up of VC++. It was throwing me lots of stupid errors.
LMAO :) :) The errors are reported for a purpose -- because you wrote a buggy program. There are some warnings about depreciated standard C functions, but you can easily disable those warnings so that they do not appear.

The only compiler I have been able to get Code::Blocks to work with is MiniGW.

Rashakil Fol commented: lololol +6
pspwxp fan commented: tnx :) +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

plz help me 2 finish my c++ proj on supermarket.i need the exact details of the funcns,sub calculatns.............
urgent

How urgent is this? Deposit $100,000 USD into my paypal account and I'll help you out.

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

We don't do your homework for you. What exactly do you want help with.

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

>>My problem is I don't know how to ignore all characters after the first

Use getline() to get the entire string from the keyboard, then follow Vernon's suggestion.

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

I would recomment you learn wxWidgets -- its a lot easier to learn than pure win32 api and its portable between MS-Windows, *nix and probably MAC. AFAIK it doesn't require .NET.

>>.It must be easier than C++.
LMAO

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

You have over 200 posts and should have known the rules and that posts are not normally deleted unless they violate DaniWeb rules.

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

Are you talking about *.doc files generated by Microsoft Word? I've never tried it but I can imagine it would be extremly complex to do outside MS-Windows and MS-Word. There is also Open Office that produces *.doc files, but they are not quite as complex as MS-Word.

You might start by reading this Microsoft article

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

create a loop then prompt to input each of the fields.

for(i = 0; i < 5; i++)
{
    printf("Enter id ...\n";
    fgets( s[i].id, sizeof(s[i].id), stdin);
    // etc etc for each of the fields
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I am saying you do not need any for loops -- NONE. Just delete lines 26 thru 33 because that is the wrong way to do it. Here is all you have to do. As I said before, you are overthinking the problem, making the program too complicated.

top of loop
   enter a number
   is number < lowest
      yes, set lowest = number
   if number > highest
      yes, set highest = number
   add number to sum accumulator
   increment quantity if numbers entered
end of loop
calculate mean
infern0 commented: Great Advice +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Unfortunately AFAIK push_back is the only way to initialize it. The vector is a single object, not an array of objects, so an initialization list is not possible.

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

First off, that is a C program, not a C++ program.

To fix the errors, declare manager* outside the switch statement. It does no good to declare the pointers like you did because they do nothing and are destroyed as soon as the break statement is executed.

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

you will have to look at the class declarations to find out how subscribe is declared. If its not in the same class as bb then it must be in one of bb's ancestors.

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

You mean "Please write it for me"??

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

You said it yourself: Here 'MediumIndication', is a Class, 'mi', 'cs' are object of a class, 'subcribe' is a function, 'getParentModule()', 'getId()' are functions. droppedPacket is also an object of a class. 'bb' is a pointer to a class. I hope it is now clear to you.

What more do you expect from us??

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

do it any way you want to.

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

when is wrong is that you have too many cin's. YOu are making this a lot more difficult than it really is. All you need is one cin loop. You don't need any for loops in this program.

while( cin >> num)
{
   // do all calculations here
}
// now find the mean value and print everything.

BTW: In case you don't know, you have to press Ctrl+Z <Enter> to exit that loop.

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

Average: sum of all the numbers entered divided by the quantity of numbers entered. So if I enter 5 numbers (1, 2, 3, 4 and 5) the average will be (1+2+3+4+5)/5. You need to do the same thing in your program. Just keep summing them up as you enter the numbers, keeping track of how many you entered. When all done entering the numbers then you can make the final calculation.

The range is found by keeping track of the largest value entered and the smallest value entered -- you need two variables to do that. When you enter a number check to see if it is smaller than the smallest value. If yes, then change the smallest value to be the same as the number just entered. Then check if the number just entered is greater than the largest number entered so far. If yes, then change the value of the greatest number to be the value of the number just entered. When you stop entering numbers you don't have to do anything more because its all done.

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

If it is a character array then use the functions in string.h header file. strlen() returns the length of a character array while strcmp() compares two character arrays.

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

you don't really need the at() method, just index it just like an ordinary array if ((setlist[i]==true) && i != setlist.getLargest() Notice that method getLargest() does not take any parameters. Also note that getLargest() will return the index value not a value from the array.

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

I do that too. The more people you learn from, the better you will be. :)

I have found over the past 20+ years that programming is a life-long learning process. Most people never get to the point where they can say "I know everything there is to know about xxx language". There is always someone else who will think up a new way to use the language. (The only person I know who would probably break that rule is Sane over on PFO). I can not tell you how many different things I have learned about C and C++ just by reading threads here on DaniWeb.

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

Not with C or C++.

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

unix is an operating system, not a compiler. You are probably using gcc or g++. The debugger you want is gnu's dbg -- tutorial here.

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

If *nix drivers are so superior then why doesn't my Logitech wireless mouse work on Fedora 11 but works perfectly on Vista Home? If it were the battery then it would fail on both os.

I will admit that the file system on Fedora is a lot faster than the NTFS on Vista. I have some test file-intensive programs ported to both operating systems and they all run quite a bit faster on Fedora.

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

Like I said in your other thread just a few minutes ago (you may not have seen it yet) -- learn how to use your compiler's debugger so that you can find out things like that yourself. You can not always relay on other people to debug your programs for you.

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

what compiler are you using? If it has a debugger then learn to use it so that you can find out what is wrong with your program.

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

fstreams. Also google for fstream tutorials. ifstream is for input files, ofstream for output files. With a little practice its not all that hard to do. Exactly how to do it will depend on file contents -- post a couple lines from the file.

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

you could use 1) ncurses or 2) vt100 mode api calls. There are probably other ways too, such as termcap

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

why not just post them here??

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

I think there were server problems yesterday. A few other people had double replies also.

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

maybe you need to force the message box to be repainted.

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

First you have to find out where tv.lib is located on your computer then tell your compiler. How to do that will depend on the compiler you are using.

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

You would have to take the input "2 + 4" and rearrange it in reverse polish notation format. google for it and you will find examples.

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

Yes, it will compile both C and C++ programs. Just name the file with *.c extension and it will be compiled as a C program.

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

I don't get it?

The Onion is noted for its scarcasm -- something like the skits on "Saturday Night Live" TV shows. Never take anything you read on The Onion seriously.

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

its illegal to play copy protected dvds on linux in the US so fedora (as redhat is a US registed company) blocks you from easialy doing this.

Huh?? Its ok for MS-Windows (Windows Media Player) but not for *nix?? That doesn't make a lick of sense.

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

Yup, it was. But the first response, and the only one i was interested in (Convert to 24-bit bitmap) didn't work. As for the IrfanView one, i want to do this using C/C++ code, not a third party software :)

you can not create *.ico with c++. You need some sort of graphics editor to do that. IrfanView does nothing more than convert files in whatever format you want. I've never used it so I don't know how it works.

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

Implement them as function pointers.

kvprajapati commented: Well said. +6
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I think you have to rearrange this into polish notation. For example, if I enter "100 + 2" when the + operator is reached your program attempts to pop two values off the stack, then in fact there is only one value (100).

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

The instructions seem pretty clear to me. Just do them one at a time, from top to bottom. Do the first requirement, compile, fix error messages, then when that is finished do the next requirement.

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

That's what C language was supposed to do too, but it doesn't because programs like to interface with the operating systems and the hardware. That makes them os/hardware specific which require program changes when porting from one os/hardware configuration to another. I would expect Voyager 7.2 Pervasive Software Platform to have the same problem.

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

Its not possible to distinguish between the two. After the number is input into the program they are both the same.

>>what i want to know is that at the time of using the passed array
>> in my function is there a method by which i can know whether it
>>contains decimal or hexadecimal values????

That is not possible. Just return the value and let the calling function do what it wants with it.

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

An integer can be treated as either decimal, hexadecimal, or octal. As far as the program is concerned they are all the same. Its only us humans who know the difference when they are displayed, such as cout << hex << number << '\n';

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

Or if you're going to say that - then you haven't read it!

Its not a real review on Windows 7, its a review on Windows 95.... You know comedy?

The whole site is an article based comedy site of made-up atypical stories. Which I suppose I should clear up, before someone goes off the wall, on a rampage, with no realization of that fact.

Ohhh I see now. Its like The Onion :)