"You get what you pay for."
-- unknown wise guy
"You'll pay for that"
-- probably the same guy
"You get what you pay for."
-- unknown wise guy
"You'll pay for that"
-- probably the same guy
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:
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]
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.
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.
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:
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?
... 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.
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
?
It's printing out the word "mismatch"? That's weird.
What are the parameters for the function -- how are they defined in the prototype?
So what's wrong? And don't say "it doesn't work" we know that.
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.
Where is this thread heading to?
Into the Closed Thread heap for too many useless bumps.
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.
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?
Arjen Anthony Lucassen's Star One. Anyone ever hear of it?
Good choice. But as I said, come back to it. It's an important part of programming.
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.
Sorry, I misunderstood what you wanted. Thanks Narue
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)
Can you add a variable? Maybe one that counts the number of mugs bought?
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.
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.
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?
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.
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.
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.
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.
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.
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.
strcpy(choice, "yes");
Anywhere you need it initialized.
:icon_rolleyes:
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?
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?"
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.
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:
There is none.
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.
Closed.
Do not post the same question in multiple forums.
Esto es un sitio de habla inglesa
Cerrado. No fije la misma pregunta en foros mĂșltiples.
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.
:icon_razz: back....
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.
Try to use fflush(stdin) before reading. It will flush the standard input(keyboard)
Never, NEVER, NEVER use fflush(stdin)
. Here's why.
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.
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.
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?
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?