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

The way to do it in Turbo C is to use the functions kbhit() and getch() . You will not be using the scan functions because they will stop the program.

Anyway, you should never use the scanf() to read a string. Here's why. It would be useful to read the entire series on the function so you can head off any problems now before using scanf() drives you crazy.

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

You forgot EBCDIC :icon_wink:

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

Thanks for the link. I just read your post there. So it looks like unless you use cin.ignore(), you would always need to type cin.get() twice. There's no cleaner way...

Yes, there are cleaner ways. First is to not use cin . Read a full line into a char* or a string and [search]parse[/search] the line to make sure the input was entered properly.

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

I'd start with plgriffith's program and make a minor change

#include <stdio.h>

int main()
{
    char buf[] = "abcdeedcba\nabcdxxdcba\nabcxxxxcba\nabxxxxxxba\naxxxxxxxxa\n";
    int  i;

    i = 0;
    while (buf[i])
    {
        putchar (buf[i++]);
    }
    return 0;
}
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I'm with neik. Looking at the list I have not even looked at the forum these threads/posts came from.

So what's this Subscription Spy supposed to be showing us? It's not threads we've replied to... :icon_confused:

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

hey actually i have to design a text editor in turbo C..
i havent made the code yet...
plaese help me out..
or if anyone does have it plaese mail me at [email removed]

Help you with what? The design? Giving you code?

How about starting with the design as you said. You can certainly get started on that.

can u plz fwd it to me??..that would prove to be very helpful in stsrting with the implementation

No, emailing you his code is a bad way of stsrting the implementation. Making your design would prove more helpful. As would proofreading and writing in English.

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

Yes, I know
1) I have to navigate back to the home page
2) takes multiple clicks and mouse movement
3) I don't look at every single thread

#2 is probably the most usable for timing purposes.

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

Yes, I noticed that the folder greyed out. I was under the wrong impression that if I generated the forum list, the 'first unread' would get me to the first post at the time I generated the list. I had no idea the link was a relative link and it would change on me.

Unfortunately, the way the code is designed, posts can get easily lost between the time a forum list is generated and you finish processing the forum. Any posts posted after you've finished a thread and before you get back to double click the folder will also become 'read', and therefore lost.

I guess I'll have to use the "forum tools" dropdown, unless you've added an easier link for marking a forum read on the forum page. Yes, I hear the groans about easier -- I've always been a proponent of the one-click club because I have rat-o-phobia -- I don't like the mouse and no one ever programs keystrokes anymore. Oh well.

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

Problem #1:

I'm not very good at structs and classes and haven't tried any problems, just read it from the book.

Then you are not learning. All you're doing is reading which by itself is worthless. Start at the beginning of the book and do the work after you read the text. That's the only way you can learn programming -- by doing.

And just follow the book in order. Don't jump around. If you don't like the book you have, find one you like. As you already tried, check your library.

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

I can help you. I have been using Turbo C++ and Borland C++ for the past 2 years.

However please note that you cannot use Turbo C++ to output any sort of graphics as BGI graphics is not supported in windows.

Not true. BGI works just fine at least through XP. Vista I refuse to run so I can't test it, but I've run BGI on XP without problems.

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

What krnekhelesh said, except it's ifstream since use implies read, not write. To answer the rest of the question, searching your entire disk for the file is
1) difficult to program
2) time consuming to run

Best to just read the file from a specific location.

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

Dang! I lost the results on the C forum, and the C++ forum worked.

I just had a thought -- I think I just figured out whats happening. Here's what I do:
1) Middle click on the C/C++ forum to open the forum in another tab, expecting the 'first unread' icons to point to first unread posts.
2) Double click on the folder icon to mark the threads read.
3) Go to the tab and start middle clicking on 'first unread' icon.
4) Each thread is now at the last post.

What's happening is the double-click on the folder dynamically resets everything -- including the icons on the thread tabs. Which means before I even look at the threads, they've all been marked read.

Up until Oct/Nov, that double-click did not reset the "first unread" icons. Now it does.

I'll test this tomorrow.

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

It would :) Cool. However, it would have to be existing threads that you visited, then hours later other people replied to, and you never went back to them.

Happens all the time!

On another note, if you don't remember what you visited 5 days ago, then how do you know that the system is broken? :)

C'Mon, I've explained that over and over! If I haven't visited any thread in 5 days, there are enough new ones that I should see pretty much only post #1. I always see the last post.

IOW:
1) If there's a thread I've visited before with 11 replies, and the last post I saw was #3, clicking "first unread post" gets me to post #12, not post #4.
2) As above, I never visited the thread, and the post I was taken to was not #1 but #19.

That's how I know it's broken.

Next post, list of threads I'm visiting with the last post number in the thread.

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

It would be easier if I just click on a few and tomorrow night you can look at them. I definitely don't remember what I visited 5 days ago. Would that work?

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

Well, I missed the entire thread posted above, 19 posts in 5 1/2 days. I am missing posts less than 24 hours after moving on. So unless that 10 days for me is 2 time units short (10 minutes) that's obviously not the problem.

That is the only thread I looked at. Did you see the problem when you logged into my account? As I asked before, would looking at my cookies help? I believe that is the only thing on my computer that if there's an error would have this affect. But DaniWeb writes the cookies.

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

Well, I haven't logged into the C Forum since my last post in this thread on the 18th. Just went to the "first post" in a thread and this was it.

I guess we're not even going to be looking at this situation so I will not continue this thread. I may visit the Software forum some, but searching for the first post in a long thread (6 or more posts I suppose) is not likely so I'll probably just look at short threads.

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

The way I process all the forums:
1) I open DW in Software index using FireFox
2) Middle click on the forum name to open the forum in a new tab
3) Double Click on the folder to mark forum read
4) Change to the forum tab
5) Middle-click on each "First Post" icon to open each desired thread in new tab
When I nav to each tab, the last post posted is usually the active post. I might have 1 to 10 posts above that post, all of which were posted after I left DW, usually the night before.

If you need to log in to my account to see what's happening to me, be my guest. I won't return to Software forum until tomorrow night so tomorrow afternoon you can see what I'm up against. Hopefully.

Would seeing my DW cookies help? Especially if you don't see what I see?

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

This has been going on for over 3 months now. And only in Software Dev, nowhere else. I am getting tired of searching for the real First Unread Post, esp when it's on a previous page.

I will continue check out other forums, but Software is rarely going to be one of them until the problem is looked at. It's too much of a PITA.

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

I'm ON Yahoo. If I change to anything else, I lose money two ways:

- Clients know where I am now.

- Monthly fees.

You don't change email addresses for your entire life :icon_rolleyes:
You get a different YAHOO or HOTMAIL account and put that in the email address for DaniWeb.
You then have no problems with DaniWeb emails. And it keeps your 'client' and 'fee' emails separate from your 'fun' emails.

Also, at my last location, there was an ISP monopoly. You had to have one email address that could never change.

So? I have multiple emails -- 2/3 go through my ISP, including the one that never changes.

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

Well, the first thing "TO DO" is to decide what you need "to do" for each section you labeled "TO DO". That is the first part of your assignment. Once you figure that out, we can help you implement the code (starting of course with your attempt).

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

Man you have to keep in mind i have been doing this for only two months. I am trying really hard to learn the ropes, so please refrain from giving me crap about writing code and formatting because i do what i think is "correct formatting". I am trying my very best and appreciate all of the help, because this stuff is very overwhelming to me and i am trying hard to understand it.

I'm not giving you crap. You don't have to get defensive. If you are trying to "learn the ropes", doesn't that include learning how to format your code correctly? Especially from a professional programmer? If you are new to programing, how can you expect to have "correct formatting" yet? I'm simply pointing out one way to learn it.

If you format your code properly
1) You will be able to follow it easier
2) We can follow it easier
3) We can give you better and faster responses because the code's easy to read.

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

Maybe if you'd format your code properly you wouldn't have this bracket problem. Give it a try, please.

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

nm

What about New Mexico?

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

How do you expect to use a database management system and not have to install it?

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

After 23 posts, did you ever notice there were words on the background of the textbox you enter all your posts? They also explain CODE tags. So do various threads at the top of the forums, and the Rules.

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

In C++, that would be something like this:

if (m % n == 0)
{
// code to flag n as a factor of m
}

Another option if you don't know the % operator is

if ( ((m/n) * n) == m)
{
    // n is a factor of m
}

This uses the knowledge that integer division does not deal with decimals. 15/4 = 3

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

I have my code written very nice on my compiler with proper spacing and good alignment, how do i put it on daniweb so it looks like my compiler. everytime i make a thread and space it right the preview of the post looks messed up....

1) You could read The Rules as requested when you registered.
2) You could read the post titled "Read This Before Posting" at the top of the forum
3) You could read the words on the background of the box you typed all your messages in.
:icon_rolleyes:

Check out this link on how to do it (I'm linking rather than showing you myself because I myself haven't figured out how to make it display the words "code=C++" and "/code" as text without it getting interpreted as code).

You mean like enter code? :icon_wink:

VernonDozier commented: Cool BB Code +1
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

A "database" does not have to be a pre-written data management system. It can be a file or three that contains the data you need for a project, and a few routines you write to access the data. Use the KISS principle (Keep It Simple Stupid).

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

Pursuit of such skills are as irrelevant to a programmer as it would be for an aspirant mountaineer to learn how to make ropes out of camel's hair.

You wouldn't say that if you were lost in the Sahara Mountains! :icon_mrgreen:

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

u can also getch() but it doesnot work in some compiler.

Why do people insist on making bad suggestions, especially after a good suggestion has been made?

And if you read the Rules, they request you use the word you, not the letter u, so people that don't speak English well can understand your post.

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

Another thread with the same question. Closing.

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

Yes. Each letter has a numeric value. 'A' = 65, 'B' = 66, ... 'Z' = 90. So you can use a loop of some kind.

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

Use .find() to find the spaces. If you find 2 spaces with 4 characters between them, use .replace() to replace the 4 characters.

And remember, the end of the sentence may not end in a space, but it may end in a 4-letter word.

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

Follow your code:

int main(){

	const int size=30;
	char filename[size];

	cout<<"Enter the file name that you will like to encrypt: \n";
	cin.getline(filename, 30);

	fstream dataFile;

	// open your file for OUTPUT
	dataFile.open(filename,ios::out|ios::binary);         
	if (!dataFile){
		cout<<"could not open.. exitting\n";
		exit (1);
	}

	// create a char buffer.  It just contains junk because you did 
	// not initialize the contents
	char list[size];                           

	// Overwrite your file with the junk
	dataFile.write(reinterpret_cast<char *>(&list),size);    

	if(dataFile.fail()){
		cout<<"failed to write..exitting";
		exit (1);
	}
	dataFile.close();

	char filename2[size];

	cout<<"Enter the file name that you will like to create: \n";
	cin.getline(filename2, 30);

	// encrypt the junk
	for (int i=0; i<size; i++){
		list[i]+= 10;	              
	}

	
	ofstream outFile(filename2);

	// output the junk
	outFile.write(reinterpret_cast<char *>(&list), size);  

	outFile.close();

	return 0;
}

If you comment your code, you would have seen the problem (I hope). The only thing is you must comment based on what the code itself tells you, not what you think it's doing.

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

So what's the problem, other than not using CODE tags as requested in the Rules. Maybe you need to read Read Me: Read This Before Posting too.

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

to WaltP:
Sarcasim is Anger's Ugly cousin WaltP ;)

Oh, give me a break! :icon_rolleyes: Sarcasm is/can be a humorous way to get a point across when someone isn't listening. You would have laughed it this wasn't your post! :icon_wink:

I understand though, I will post the code I have soon as I get home. I am also sure I read over the break after each case implementation, I will go back to that part of my book.

Good, because it's in there

To your last statement, I have read the rules and the read me, I do not believe I am in violation of anything as I did not find a post anywhere on this,...

True, there are no violations. But you want help on your code. From the Read Me thread:

Keep the code short and sweet!

As much as we don't care, people insist on posting pages and pages of irrelevant code. Keep the code as short as possible. If the code isn't short, make it short by cutting out as much irrelevant code as possible. Ideally, we expect you to write a small test program that exhibits the problem you're having.

Granted, Narue didn't explicitly say "post your code", but isn't the implication quite strong? If we can't see your code, we can't tell you what's wrong with it.

Roebuc commented: A funny guy! +1
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

the number is 1 until 139

no number below 1 and negative.

OK, then I update my quote with this new information:

One digit after another.

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

The string with the %x symbols in it are parsed to find each symbol. The letter is then looked at to figure out what field is supposed to go there. Then the string is changed by removing the %x and whatever field is requested replaces it.

Usually the data comes out of variables and/or structures the program has already read or generated.

There is no function to do this if that's what you're looking for. The function is written by the programmers developing the system.

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

How to correct the output, because for the bold it follows every studentid.

Why do you insist on not giving us the information we need to understand what you want? When was the last time you read the post Read Me: Read This Before Posting? Start explaining in detail what you need.

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

0.24, 0.5, 0.997

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

It would help if you'd format your code so we can follow it's flow. Proper indentation is crucial to understanding.

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

To WaltP:
I don't have the code, I mean I started it last night but it is not finish or correct for that matter.

Oh, OK. We'll just wait for you to finish it correctly so you can post the code. But then, you won't need our help, will you? :icon_rolleyes:

Have you read any of the recommended posts, like the Rules and the thread titled Read Me: Read This Before Posting?

to Zhelih:
Really? Why? My book and teacher did not say anything about that. Is it just for organization? cosmetics?

If they didn't, you need a new book and a new teacher. Look again.

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

After a couple requests and an explanation on how to use them, you still refuse to use CODE tags. Is there a reason for this?

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

How to arrange the number properly?

One digit after another. If there is a portion that's below 1, add a '.' and that portion. If negative, '-' in front of all the digits.

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

>now how do i delete this thread?
We don't delete threads just because the original poster's question is answered. However, if you want, a moderator can mark this thread as "solved".

You don't need a moderator to mark a thread solved. If you are the original poster and got the answer you need, you mark the thread solved.

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

I promise never ever ever to use gets() again

Why? are you just going to believe him with no understanding of why he claims it's bad? :?:

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

I did test the code, and it did work. I realize it is not the most efficient way, but like I said, I was accomplishing his purpose with his methods.

If his method is a problem, you are allowed to tell him so and explain why. I completely disagree with dividing the values by those floating point conversions. More can go wrong that way.

With my style, the fewest "errors by floating inexactness" will occur. And you don't need so much floating point math.

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

Jboy05, it's rude to post continuously just to bump your thread. The people here have lives outside the forum and 9 of the 14 posts here are yours. Patience!!!

Next, ignore everything zhelih said. Stacks are not needed at all.

Do you know how to use a while loop? Do you know the % operator? I assume you know division (/). These are all you need.

If you get the last digit of the original number, that is the first digit of the reversed number (use %). Store it in the reverse integer.
Remove that digit from the original number.
Then get the 'new' last digit. Multiply the reverse value by 10 and add the digit. From there, think through the rest of the instructions and see what you come up with. Your while loop should be less than 6 lines.

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

If you are converting cm to yd,ft,in, first thing to do is convert your centimeters into inches. All this can be done with integers, you'll only be off by about 1/2 inch as long as you round properly..

Then, using the division you can get the number of yards. The remainder will be the number of inches left. Then do the same for feet. What's left is inches.

Convert what I have above into a set of step-by-step instructions, then you should be able to code the program easily.

By the way, this will also alleviate two of the three conversion factors in your posted program.

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

I made some modifications, but it still not working properly. Any help, tips would much appreciated !

OK. read the post titled Read Me: Read This Before Posting