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

Why? Why not get a computer from a reputable place that actually will give you service and put everything you need into the computer rather that an off-the-shelf this-is-what-we-got solution? And without all that extra crap software, too.

In case of problems, do you get the M$ OS cd's so you can actually reinstall?

Just askin' :icon_wink:

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

Then why are you bumping the thread when Jonsca pointed out a problem? Fix the problem and try it again.

In case you didn't understand his post, check you book for the difference between ' and "


[edit]Wow, a plethora of replies during compose time!![/edit]

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

If you can use loops,
- recurse to the end of the string as before
- don't output during the return spin until you reach a space
- if space, loop outputting the characters following the space up to the next space or '\n'

If you can't, set up one more recursive function that outputs a single character and increments until space or \n.

IOW, to reverse a string you output during the return cycle
To print the string straight you output during the call cycle, Nothing happens during the returns.

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

I don't really know what the data looks like, but jonsca hit on something I feel a need to expand on.

Assume you are at:

printf ("What is the name of the person?\n");
fgets (name[j], 10, stdin);

and the you enter the name
Montgomery
you just entered 11 characters and the program read 9. It read
MONTGOMER and added the trailing \0.
The next fgets() will read the y[enter] and immediately continue. You won't get a chance to type anything.

You need to be very careful when programming input for the keyboard, taking into account slightly irregular input like this.

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

LOL really :)

***Jokes apart***

Let me point out, such kinds of threads do degrade the quality of the forum !!
I don't know what moderators do to such kind of threads here ?

Usually we read it and either laugh or groan. I chose laugh on this one. Other than that, there's not much we can do. DaniWeb has a policy of not deleting posts except in rare cases, so if stupidity reins, stupidity stays for all to read. Let's hope a prospective employer doesn't see 'your' [the generic stupid poster's] post in that case :icon_wink:

PS : I hav gone too off-topic already for anything more to be said ;)

You and everyone else it seems. I am contemplating moving the "good stuff" somewhere better, but haven't decided yet.

And since we're being somewhat silly here, have ends with an 'E' :icon_smile:

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

... but I don't understand how to get it to print the variable score's value in line with another string...

you can't add an integer to a character array. You need to convert the integer to a character array then concatinate them. Kim has one way, ssprintf() is another (may be easier, but older C-style code). Research how your book converts ints to chars and see what you can come up with.

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

What function? textout_ex?
I don't clearly understand your question.

Of course textout_ex . Is there another function in the code you posted?

kim0000 gave me the answer....

How is the third parameter defined in the prototype kim0000 posted?
Does the third parameter in your call fit that definition? That is the type of "SCORE: " + score ?

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

It's printing out the word "mismatch"? That's weird.

What are the parameters for the function -- how are they defined in the prototype?

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

So what's wrong? And don't say "it doesn't work" we know that.

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

give me a code to calculate the sum,highest,lowest and average?

Pretty demanding for a first time poster who can't be bothered to read the Member Rules or any other posting instructions on this site.

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

You are attempting to strcat() to a variable that cannot be added to.

What address have you loaded into dir_nm ? That address space is not completely under your control (for example, how large is the space, enough to add characters to?) so you should not be changing it. You need to create you own space and load values into that space instead -- space you control.

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

thats wat im stuck on . when i find one i will put it in my switch statement.

What do you mean "when I find one?" It's your program -- add one.

and r u talkin bout something like this

(TOT_MON -= teeshirt)

- keeps track of money spent

(numb_item += 1

How does that statement count the teeshirts bought? Maybe something like num_teeshirt += 1; might work better?

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

Arjen Anthony Lucassen's Star One. Anyone ever hear of it?

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

Good choice. But as I said, come back to it. It's an important part of programming.

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

That's is not as easy as it sounds...

You need to
- input the number as a string
- test the string making sure only digits were entered
- if not, output error
- if so, convert the string into your number.

I'd wait on this until you learn just a little more, specifically strings and characters. Give it a week or two and come back to this. It's a good task to understand.

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

Sorry, I misunderstood what you wanted. Thanks Narue

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

Can you add a variable? Maybe one that counts the number of mugs bought?

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

First of all, in English there are things called sentences. They use periods at the end and the next sentence starts with an upper case letter. It helps us understand your question.

Second, if you'd format your code, some of your problem would be immediately apparent, and again, we could understand your code.

Most error checking is done by
1) writing the code on paper and double/triple checking it before typing it into the compiler. You play the part of the compiler.
2) compiling the code, looking at the error and the designated line, and figuring out what was wrong with the specified line based on the error text.
3) asking an explicit question here which includes the error, the line(s) in question, and what you think the problem might be.

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

How can you follow that program? The formatting is inconsistent making it very difficult to read. See this

I can't be certain if this is the cause because of your formatting but with all the fgets() in your program, why are you using that single scanf() ? See this too.

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

If you go to 3 stores, and you buy a mug at the first store, 2 mugs at the 2nd store, and 1 mug at the 3rd store, when you get home how can you tell how many mugs you bought? How can your program simulate that?

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

Better. But not quite. Put the tags around the CODE only. Not the entire message.

At least a step in the right direction.

Now you need to format your code. Indenting is required for people to follow it.

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

what are the code tags ? i will put them on there if i knew how an error comes up when i do it. arent they just codes for people too type in so when someone to help people they use the code tags? r am i wrong?
just let me know cuz this site is pimp it helps me out alot

Read your PM.

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

Oops, didn't think about putting that after the comma. I'm on a roll today.

I wouldn't put it after the comma. It should be the statement before.

IMAO, comma'd initialization is bad form unless it's absolutely necessary.

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

Does your system/compiler actually handle 64 bit values?

The 'easiest' way to handle this is to create a union using your double and a byte array. Then output the binary from the bytes.

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

OK.. I guess it is the difference of newline characters in windows and unix. I tried on Unix and it worked, forgetting that it may not work in the same way for windows. Probably you can try this

cin.ignore ( 80, '\n' ); //reads and discards 80 character or until newline

... That will probably help, if you put it in the correct spot.
Add the ignore line just above the cin.get() at the end of the program.

And if stuff doesn't work after you've changed it, since we don't know what you changed, we can't reliably help.

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

I'll give you the benefit of time this time. You received an infraction warning about CODE tags 7 minutes before posting this. Last warning.

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

Of course it's harder. If you can find all the strings irregardless of the comments, it's a simple matter to modify that code to find the comments and remove them first. This ain't rocket science. If you can do one, you do the other with a minor code change. Then put them together. Again -- sheesh! I don't mind telling noobs they have to think to program, but having to tell seasoned programmers the same thing is just annoying...

And what the heck does tetron's first post have to do with anything in this thread?

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

And why do you refuse to give us any important information -- like what was the answer you wanted, what was the answer you got, where in the 200 lines of code you think the error is?

Get with it -- we can't read you screen. You need to give us the information that explains the problem, not just "there's a problem somewhere - what is it?"

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

Add a portion of your code in your post -- the part that's giving you trouble -- with CODE Tags (don't ask, they're explained everywhere).

And a complete explanation of the problem code helps.

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

All you have to do is find the ", and if found, find the next ". Copy the stuff in between. It's simple.

Tokenize... sheesh! :icon_wink:

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

There is none.

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

Closed.

Do not post the same question in multiple forums.

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

Esto es un sitio de habla inglesa

Cerrado. No fije la misma pregunta en foros mĂșltiples.

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

When talking about integers, they are all stored in binary. You can display them in decimal, hex, octal, sixbit, etc. but they are all in binary. To see the value in hex, all you need to do is output with the proper format specifier: %X-hex, %d-decimal, etc.

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

Try to use fflush(stdin) before reading. It will flush the standard input(keyboard)

Never, NEVER, NEVER use fflush(stdin) . Here's why.

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

Then you need to ask the instructor how to link and compile with POSIX sem.h. It seems to me that's his job to help you set up non-standard functionality.

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

Ok, I've figured out how to display the file that the user asks for. But when they enter the wrong file it tells them that there was an error opening the file that they choose. Does anyone know how to make it keep looping the question until they enter the right file. I know how to make a loop with numbers but not with text variables. Thank you for everyone's help.

Here's a BIG hint:
"Does anyone know how to make it keep looping the question until they enter the right file." And while we're looking at code, nice formatting. It's good to see someone takes pride in their code.

Two things -- Line 24, split those two commands onto separate lines. And use 4 SPACEs instead of TABs for your indents. Eventually your code will look too horizontal by using TABs.

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

Good. Cuz the answer would've been "Because you wrote it wrong"

Without details, and our lack of psychic ability, what else could we say?

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

And yet another hijack bump to a 6 year old thread. I don't think he read even one thing he was asked to read upon registering, so why would he read the important stickys and announcements at the top of the forum itself?