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

There is no standard way to read characters like getch()

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

i got the chart thanks for that.But do i need to read each bytes then decode it according to the chart?

Yes.

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

Since we know the program you posted cannot possibly compile, and you claim it's actually running, you need to repost the current code you're compiling. And then explain in detail what the program if doing wrong. Don't make us search for it.

tux4life commented: ...and then explain in detail what the program [B]if[/B] doing wrong... :P +15
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Another option is: cout << "." << flush();

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

Add a do-while loop around the main portions of the code. At the end of the loop simply ask a question. Input the answer and the while conditional can exit the loop or not.

But, you should read this series about scanf() first.

And you might as well read this, too.

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

Look back at the thread, in particular the 90 percent spam plus 910 percent issues unknown to mere mortals remark - that what Walt was referring to.

Thank you, HG. I didn't realize so many folks here had their funny bone removed.:icon_razz:

> The 910 was probably a typo
Hint: No, it wasn't. :-)

If you gotta explain it, it's no longer humor. It's just sad... :icon_wink:

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

kbhit() is useful, but using getch() is also required. Understand what both functions do, and you should be able to figure out how to use them for your program.

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

I tried to compile a code written in C which had included the file "graphics.h".It worked fine in my desktop PC which had a VGA monitor.But when i tried to run the same code in my laptop,it showed some graphics error. why is it like this?fG

Some graphics error is like telling your mechanic "my car made a noise" and expecting him to fix it.

Info! There are sticky posts at the top of the forum list that explain what we need to help you -- with the words Read me...

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

Obviously, maths is not an essential requirement :)

I agree with that 1000%!!!! :icon_razz:

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

I understand what you mean by the redundancy but that's what was stated the file reading has StudId, Quiz, Quiz, Quiz, Quiz, Quiz,
am reading in 15 rows but the max will be 40. Which is what I need the counter.

Then you should use a while loop instead of a for loop. The for loop is meant to loop a specific number of times, and the while loop is used to loop until a specific condition is met -- like reading the last line in a file.

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

How to freed allocated memory?

delete []p;

Don't you also have to delete each p array? :icon_wink:

If you aren't sure, the answer is yes, delete each array first before deleting p itself.

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

Enough, people. The facts are
1) fixed code should not have been posted by anyone other than the OP
2) fixed code should not have been improved by anyone unless the OP posted correct code in the first place.
3) People who expect the world to give them a free ride deserve the right to fail, and do not deserve the right to pass.

Now stop the flaming and get back on track.

tux4life commented: Finally! +11
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

You're welcome.

Read the rules.

Including the use of u for you, no for know, etc.

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

I never posted a problem in my life so I prob encased this code wrong too.

you did much better than 95% of the new posters that can't be bothered to understand the forum before posting. :)

1) How can I make a new line within my "output" file after six values are written?

Simply output a newline after the six values - \n

2) What would be the best way to convert these values to binary before I writ to bin output?

Not sure what you mean -- based on the input you gave. If all you want is to break the 139 into binary, use the the && operator to test the last bit of the number, and >> to shift the second to last bit into the last bit position. Repeat until done.

Question for you:
What are the digits and tabs after the number in the input for? What do they mean?

Also, read this about using feof(). You're not using it properly.

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

Here's what I have so far.

And are you still having problems? Are we supposed to use our psychic powers or would you like to explain fully what the problems are now?

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

Your 1st half of the array array[x][0] is never initialized to zero so the values start out with garbage.

tux4life commented: Yes, that's the solution :) +10
Hiroshe commented: thanks +2
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

atoi() is portable itoa() is not

tux4life commented: Yes. +10
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Thanks for letting us know. I'm marking this thread solved since the offending user has been taken care of. :)

Cant banned users still send PMs?

From the sounds of it, she had the user taken care of! Ouch! :ooh: :icon_mrgreen:

iamthwee commented: Irrelevant post -4
jbennet commented: irrelevant but still funny though +36
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

the problem that i need to use this program in another way
for example : for looping , do-while looping

So what's the problem? Doesn't your book describe a for loop and a do-while loop?

You need to try it, we aren't supposed to do it for you.

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

uRrite. Just another case of some turkey not caring that 100 pages in on a forum might be moot thread. Nothing better to do, obviously.

Salem commented: And it wasn't even a good post either! +36
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

You probably blew past your buffer and started writing to memory you should not have written to.

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

unsigned int val = (unsigned int)array[0]; // For the value 1

If the OP wants the value 49, this will work. I think the OP might want the value 1 so subtract 48 from val afterwards. But then again, he might mean something completely different.

Please clarify exactly what you want.

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

You don't need finer resolution timing. If you want to measure the thickness of a piece of paper, would you buy an expensive microscope, or would you measure a stack of 200 pieces of paper and then divide by 200?

In other words, run it a whole bunch of times until it runs to 10 seconds, then divide 10 by the number of times it ran. Now, of course, all that counting and looping will throw off your results -- after all, that code and all the calls to time() also take time. So you'll be off only by 5-15%.

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

What is the solution for that???

Write a function that searches the buffer.

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

nvm. going to ask teacher.

Smart decision. At least your teacher knows what the program is supposed to do and can ask the questions needed to help you.

tux4life commented: Good point :) +9
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Here you go. Also as a side note, system ("pause") is a bad habit.

So is:
1) posting code the OP should be writing
2) posting code that is not formatted

Please do not post answers to questions. This forum is not a homework service. And that service should include properly formatted code segments.

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

Or get image processing software like
Photoshop
Paint Shop Pro
Gimp

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

Binary files have binary information, not text information. Therefore, string functions probably will not be effective on the buffer. There are probably NULL characters in the binary data which will stop any string function from continuing past the character.

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

It looks like the parameter needs a char* not a char . IOW you need to pass the string, not the character.

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

I doubt both should be recursive.

What signs? One Way signs? Neon signs? Crop Circles? Examples are really helpful.

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

Change your comparison to if (word[i] < 57 && word[i] > 49) Also, the line is better written as if (word[i] > 49 && word[i] < 57) It's a more logical order for the comparison pair.

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

Not quite. main() should call palindrome() . This you did. palindrome() -- calls palindrome-helper() to check the 1st and last characters.
-- returns the YES or NO back to main() palindrome-helper() starts by checking
-- if no characters left to test, return YES
Then tests the two characters and
-- if same, calls itself with the next two characters (2nd,last-1; etc)
-- if different return NO

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

Hey there,

I have a simple question:

How can I read three characters by three characters from a string (character array) in C?

Thanks for your help.

You can't. A string is a single dimensional array and you need an array of arrays to read 3 by 3.

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

plz help or give some advice...
i tried a lot to do

Not that we can see. Did you read the post titled "Read Me: Read This Before Posting"

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

why do you need a helper function? seems that all the work is being done there anyhow.

Because it's part of the assignment. The helper function is undoubtedly supposed to be recursive, checking a character at a time.

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

thanks, that fixed the problem, the only thing i don't get is that i copied that from cprogramming.com and it didn't work, someone really should let them know lol

anyways, THANKS!

well, you copied the program and found the error. Maybe that someone sould be athlon32. :icon_wink:

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

Even though you haven't told us all of your situation, I surmise the problem is when you come to a function from a library that you did not write. When you get to that function, Just execute it (don't step into it).

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

thanks arkM, but what do you mean not defined?

Where is the method SipDialogPublish() defined in the class? You are calling it, so what is it supposed to do?

can I know how to define it?

That depends on what it's supposed to do and what parameters are necessary to accomplish the task.

After all, it's your class definition, isn't it?

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

I am always ready to answer your question, but not until you get a modern compiler that isnt gimped

Then stop replying posts you have no intention of of adding constructive responses to!

Adatapost, you do not have to use a jephthah-approved compiler.

kvprajapati commented: Thanks +5
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Or just give them the .h and .obj files. Others can link those in with their code. .objs are the output from the compiler and used as input to the linker.

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

what else am I missing, thanks for the help

Code tags --AGAIN!!!!

It seems that with the warning above, and the information posted all over this site about CODE tags, like
1) in the Rules you were asked to read when you registered
2) in the text at the top of this forum
3) in the announcement at the top of this forum titled Please use BB Code and Inlinecode tags
4) in the sticky post above titled Read Me: Read This Before Posting
5) any place CODE tags were used, even in responses to your posts
6) Even on the background of the box you actually typed your message in

you'd think one would get the message...

tux4life commented: Great! +8
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

In other words, test text/binary on your system and write your code accordingly.

And that test is so much faster than posting on a forum and waiting 4 days, 3.5 hours for the only really definitive answer you've received so far.

:icon_wink:

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

Unfortunately, most new users leave out the most important information and just say "help me" leaving us to guess what they need help in. At least the way it is currently, we have a minor clue.

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

C'Mon, people. Listen to what Midi is saying. He cannot -- repeat cannot -- make any changes at all to the software base of the computers at school. He does not have permissions. Therefore, any changes must be done at DaniWeb itself do he can utilize DaniWeb while at school.

Now, the question is -- is Midi using DaniWeb for school, or simply at school? :?:

~s.o.s~ commented: Haha :-) +28
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Load 19 random values. If a 0 is generated during these 19 values, remember that fact.

For the 20th value, if a 0 was not generated, load a 0, otherwise get one more random number.

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

Loop through the buffer byte by byte and send each byte to a function that outputs the binary value of the parameter.

Look up boolean operators & | << >> for this function.

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

Yes, of course it can be done. Same as text.

jephthah commented: you follow two specific and helpful comments with this? and then complain about me? LOL :P -2
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I've said this already, and I'll say this again: I still think requiring X number of posts before a user can add a signature would work wonders to stopping this crap.

But for some reason higher-ups disagree with me. *shrugs*

So do I. For people like Jen0608 with 170+ posts, it's easy to make the required number of posts in one sitting to get to the sig limit.

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

Not only do you resurrect an old thread, you don't even know what language you're dealing with. This is a C++ forum, not BASIC. Random numbers are integers.