WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

The condition you have in the while() is not working.

But why not? Maybe an explanation is in order so the error does not happen again...

while(cin)
    {
        getline(cin, str);
        s_v.push_back(str);
    }

In this code, the loop exits after cin is in an error condition. After reading the last line, there is no error.

You now attempt to read the 4th line, which causes an error. But you don't check the error. str still has line 3 in it because nothing was read this time. So you now push back line 3 again. cin has an error now and the loop exits, but the damage is done. It's simply a case of not testing for the error at the proper time.

mitrmkar commented: "Why not" ... A good point there, kudos +5
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
jonsca commented: No, I'm sorry the correct answer was 1010101010101111000110110101010101010101010101111 +2
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Although not perfect, your formatting is much better. Thank you.

I am getting a compile error I do not understand on the line printf statement right below the end of the do while loop. It says printf identifier. Help?

That's because there is no such thing as a do while statement. It is a do-while loop:

do
{
    -- stuff to do --
} while (exit-condition);

Did you look it up before using it?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

This thread is done.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Define "won't run"

400 lines of code with no idea what we're looking for nor why is not going to happen easily.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Here is what I have so far. Suggestions??

I suggest you explain the problem. We aren't psychic...

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I agree with Vernon and Dave.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Buffered output is probably the problem. End the cout line with flush to empty the buffer immediately.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

You are dealing with floating point numbers. .99 probably is stored as a close approximation of .99, very close. But not close enough. Same with all the other values. Therefore, you have a little wiggle in the values and probably end up with something similar to -0.000000001 as an answer.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Enter text in the textboxes
Select the records from the database and look for a match.
If found, open the new form.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

"If you keep doing what you're doing, you'll keep getting what you're getting. If you keep believing what your believing, you'll keep achieving what you're achieving."
~ The Uncommon Way by David Wolfe

A different way of stating this is

A Definition of Insanity:
Continually doing the same things over and over and expecting different results.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I just hate when someone in the office downloads huge amount of files because the connection starts to slow down.

His wife won't let him download that stuff at home, though.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

See, I ain't sew dumm...

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

The only thread I got negative, in my honest opinion, are from idiots to put it mildly. And I get down graded? The reputation and power to change reputation is really beyond my ability to understand.

I don't really see your problem. You have 9 positive rep posts and only 2 negative rep posts. That's 82% positive. And 53 total rep points. You must be doing something right. And if you look at the reputation comments, I see 7. All positive.

IMO, the reason your VB post was negged was the statement

No arguments. Mark thread as solved.

I realize it was probably said in fun, but at least 2 people thought you were being a know-it-all, and slamming their choice because you didn't agree.

I see your post here was also negged. Calling people name is not a way to get positive rep. And giving an ultimatum to the community and mods or we all get a one-finger salute does nothing to make us thing better of you. Sorry.

Take what cscgal said to heart -- ignore rep. It really means nothing.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

padalhan u naman poh aq ng database program s turbo c sa email q ***

1) Put your hands on the proper keys when you start typing.
2) Type full English words, not Gobbledygook
3) If you have nothing to add to this thread, start your own.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I let you in on a secret, don't tell anybody else, I love to eat out in relatively close by Las Vegas.

Oh, I thought you were a car lover :icon_razz:

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Enough.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

To expand on the cryptic "Dont use gets" statement, see this.

Caveat:
Though I agree wholeheartedly about not using gets() , I would let it go in this and only this program
1) because you declared the arrays as 256
2) this is simply to test the concept of comparing strings
3) after this program you forget you ever heard of gets() Do we have a deal? :icon_wink:

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Thanks. also, is there a better way to print out stuff to allegro besides using textout_ex?

It seems like textout_ex is going to thoroughly p*ss me off seeing as how specific if you have be to make it work.

Wrong attitude. It's specific because it needs to be. Once you understand what it needs it's a no brainer to give it what it wants.

And if not being able to pass char* + int / double in a single function parameter is going to p*ss you off, maybe there's still room in shop class :icon_twisted:

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

"You get what you pay for."
-- unknown wise guy

"You'll pay for that"
-- probably the same guy

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

It's best not to use EOF.

EOF is fine. It's best not to us .eof() -- a big difference. :icon_wink:

jonsca commented: You're right. A false assumption on my part. Time to dust off Kelley/Pohl again! +2
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

By reading a tutorial. Did you bother to look at the posts at the top of the forum as suggested? Or are you expecting us to teach you post by post?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Sure. Try this

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Where is this thread heading to?

Into the Closed Thread heap for too many useless bumps.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

From no Code tags to Code tags every 3 lines. :icon_rolleyes: C'mon, put CODE tags around your code. Don't add them just to add them. Don't add them around questions. Only the code -- all of it. Once -- unless you have two distinct pieces of code (two files, two functions that aren't connected)

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

strcpy(choice, "yes"); Anywhere you need it initialized.
:icon_rolleyes:

jonsca commented: This round's all yours ;) +2
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I have one error now..... What does this mean?
: error C2064: term does not evaluate to a function taking 3 arguments

Something in your code is specified as a function with 3 arguments, but isn't a function with 3 arguments.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

:icon_razz: back....

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

In layman's terms:

What precision do you need? If 3 decimals, an EPSILON of .000x or smaller would work.

invisi, it is not recommended to compare doubles for equality. The value 25 could be 25.0000001 or 24.9999999. Both are essentially equal, but floating point values are rarely exact.

Nick Evan commented: the "compare a float bug", it's classic :) +12
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

OK, I did it. Now it's your turn.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Brief fix! For something posted 6 years ago? Not brief enough...

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Do't know why I didn't think of that... Thanks again...

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Whoa! dhanyavad!

No comprende.... If the page changes, I thought the cache would be overridden.

Database :icon_rolleyes: The page istelf was still the same. It was just the database contents that does not get stored in the cache that changed. Ja?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

This is an CPU sheduling algorithm i.e proirity sheduling .It show some error that i can't solve please anyone correct it . its very urgent.

1) This is not a CODE SNIPPET. Do not post questions as such
2) Help Me is a title in violation of the Forum Rules. You did read them as requested, right?
3) How do you expect anyone to follow unformatted code? Formatting is necessary when writing code.
4) Nothing is urgent on this forum. If it's really urgent, talk to your instructor.
5) You expect us to figure out what your error is with no information from you? Presumptuous, isn't it?
6) You expect us to fix your code for you? Contact hire-a-coder.

Salem commented: Excellent +19
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

This might get you started:

#include <iostream>
#include <cstdlib>
using namespace std;
char diseaseDNNAsignature[] = 
                  { 0x41, 0x67, 0x65, 0x6E, 0x74, 0x3A, 0x20, 0x48, 
                    0x69, 0x20, 0x46, 0x61, 0x72, 0x6D, 0x65, 0x72, 
                    0x20, 0x46, 0x72, 0x65, 0x64, 0x2C, 0x20, 0x46, 
                    0x61, 0x72, 0x6D, 0x65, 0x72, 0x20, 0x4A, 0x69, 
                    0x6D, 0x2E, 0x0D, 0x0A, 0x46, 0x72, 0x65, 0x64, 
                    0x20, 0x26, 0x20, 0x4A, 0x69, 0x6D, 0x3A, 0x20, 
                    0x48, 0x69, 0x2E, 0x0D, 0x0A, 0x41, 0x67, 0x65, 
                    0x6E, 0x74, 0x3A, 0x20, 0x44, 0x69, 0x64, 0x20, 
                    0x79, 0x6F, 0x75, 0x20, 0x6B, 0x6E, 0x6F, 0x77, 
                    0x20, 0x79, 0x6F, 0x75, 0x72, 0x20, 0x73, 0x68, 
                    0x65, 0x65, 0x70, 0x20, 0x61, 0x72, 0x65, 0x20, 
                    0x64, 0x69, 0x73, 0x65, 0x61, 0x73, 0x65, 0x64, 
                    0x3F, 0x0D, 0x0A, 0x46, 0x72, 0x65, 0x64, 0x3A, 
                    0x20, 0x4E, 0x6F, 0x2C, 0x20, 0x68, 0x6F, 0x77, 
                    0x20, 0x63, 0x61, 0x6E, 0x20, 0x79, 0x6F, 0x75, 
                    0x20, 0x74, 0x65, 0x6C, 0x6C, 0x2E, 0x0D, 0x0A, 
                    0x41, 0x67, 0x65, 0x6E, 0x74, 0x3A, 0x20, 0x53, 
                    0x65, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 
                    0x66, 0x6F, 0x61, 0x6D, 0x20, 0x61, 0x72, 0x6F, 
                    0x75, 0x6E, 0x64, 0x20, 0x74, 0x68, 0x65, 0x69, 
                    0x72, 0x20, 0x6D, 0x6F, 0x75, 0x74, 0x68, 0x3F, 
                    0x0D, 0x0A, 0x4A, 0x69, 0x6D, 0x3A, 0x20, 0x59, 
                    0x65, 0x61, 0x68, 0x2E, 0x20, 0x20, 0x57, 0x68, 
                    0x61, 0x74, 0x20, 0x63, 0x61, 0x6E, 0x20, 0x77, 
                    0x65, 0x20, 0x64, 0x6F, 0x3F, 0x0D, 0x0A, 0x41, 
                    0x67, 0x65, 0x6E, 0x74, 0x3A, 0x20, 0x57, 0x69, 
                    0x70, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 
                    0x66, 0x72, 0x6F, 0x6D, 0x20, 0x66, 0x72, 0x6F, 
                    0x6D, 0x20, 0x61, 0x72, 0x6F, 0x75, 0x6E, 0x64, 
                    0x20, …
jonsca commented: Beautiful +2
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

thelamb gave you just enough for you to actually think about the change and do it properly. He did not give you a total solution...

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Your country needs more medical training.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Line 24: box(23,57,2,7);gotoxy(37,4);printf("IPHONE"); I actually ran it to see if the calculator looks good. It does... :icon_smile:

Ancient Dragon commented: Good. +26
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Subtract 24.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

So far you've refused the help. I will now be exceptionally clear and repeat: READ THIS!!!! Especially the section titles Describe your problem clearly and fully!

Did you post code? Did you explain what the problem was? Did you give us any information to help you? No. You only said "send me code" and that is asking us to write it for you.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Learn both. They both have their uses and one can do things better than the other in many cases. It also gives you the ability to choose the best language for the job.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Because in the first case, the pointer p is pointing nowhere. You defined the pointer, but never pointed it to space for the data.

In the second, you allocated data space, and the address was placed into the pointer. But the only reason it didn't segfault is luck. The space malloc 'd obviously included some fudge room. It could be that the malloc actually allocates a buffer in chunks by K. Another malloc would take more from that chunk without having to access the heap.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

This is NOT a code snippet, this is a help request. Post properly. Look up what a code snippet is if you are unsure.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Recommendation---

Start over.
Write the input function. Test it.
Write the display function. Test it.

you can copy the code from the current code to make it faster, but from now on *never* write the entire project without compiling and testing often. Write it in segments.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Hi all,

I am stuck here after several hours tried.
Here the thing. I have txt file that contain float data (1 column and many row) such like this (4 float data):

0.799
0.851
0.926
1.000

Then i want to read it as array. My code is work until this point.
After read it as array, than the code should copy each data
as much as number enter by user.
The user should enter 4 different number, since there are 4 float data in the read txt file.
For example if user enter number 2,3,1,2 respectively, the code must copy the 0.799 two times, the 0.851 three times, and so on.
Then put in the different txt file.
In this case the contain of new txt file must:
0.799
0.799
0.851
0.851
0.851
0.926
1.000
1.000

My coding failed to do this task, instead copying each of data as accumulation number input by user. So in this case the accumulative value from 2,3,1,2 is 8 (2+3+1+2).
My result so far are:
0.799
0.799
...
0.799 (until 8 row, then)
0.851
0.851
...
0.851 (until 8 row..and so on )

My guess is you're supposed to enter as many numbers as in the file, right? So after you read the file, set up another loop and input the numbers into another array. Now your …

me_roy commented: thanks WaltP finally i did it... +2
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

My questions are:
Is this a bad cut & paste?
If not:
Who wants you to deal with this piece of trash code?
When will you ever do something like this (and keep your job)?
Why do people insist on teaching this crap?

Salem commented: Great unanswered questions of our time.... +19
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

the prototype of main is already written in the header files.

He said it was solved.

u hv not written void main()

No he not wrtn tht. Dun writ leet spk, use ful engsh so ppl wth bd englsh cn unnerstnd. This is part of the Forum Rules.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Oh, you are a real winner....

please test and run it for me please i have to go sleep now...

Did I read this right? You really posted your code and you want us to test it for you? Yes, you are presumptuous. It's not our problem it's due Friday...

I said:

Do one at a time and test test test!!

Well, you did all 4 and didn't test it once. And just by looking this won't even compile.

If you decide to actually use the help you've been given, I'll help. As it is, I'm wasting my time. Good luck.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Figure out 4 parts of the program -- 4 segments of distinct functionality (input, output, etc.)
Copy the code for each section and create a function around it. What data needs to be given to the function that used to be in main() and is now missing? Add those as parameters. Do one at a time and test test test!!