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

First thing to understand is that each character (letters, numbers, punctuation) all have a specific value. Therefore, the character's value can be used as an index into an array. For example:

char *words = {"Apple", "Banana", "Cherry", "Date", "Eggplant", ...
              };  // Apple is word[0], etc.

...

    int ch;
    ch = getchar();    // accept a character
    printf("%s\n"", words[ch-'A']);    // display the word matching the letter
...

Get the character into ch, say you enter 'C' ch-'A' gives you 2 ('A'=41, 'C'=43) and you display words[2] which is "Cherry".

This should help you write your code much shorter and less complex with a little thought.

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

i have never needed a gun to defend myself

I thought you were still a teen. :icon_rolleyes:

I have never needed a gun to defend myself either, but people in large cities where criminals/drug dealers live do need them.

I grew up in Detroit and now live in Minneapolis. Both big cities (the former known as the murder city for a while) and I've never needed a gun either.

Don't know who said: It is better to be quiet and let everyone think that you are
a fool, than to open your mouth and remove all doubts.

I believe it was Mark Twain

[footnote]
Just as I was typing this, someone smashed my neighbor's car window and drove off in a rush! Hmmmmm...
[/footnote]

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

The tides went out. And when the bad guys came the tide came back and washed them all away!!!

joshSCH commented: I bad reped Aia because she was wrong. The government does have its own money. This is for involving yourself in others' business. Try reading the thread next time ;) -2
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

http://www.mslinux.org/

Great one JB! I especially liked this quote from the 'support' page:

Windows 95/NT - 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company that can't stand 1 bit of competition.

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

Hey Davey! You have an accent -- you don't type with one :icon_mrgreen:

That breech is incredible. How did you find it? And what were you doing when you ran across it?

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

Something like

On Error GoTo FileError
    Open FILENAME For Input As #1
    '' if the file did not open you will jump to FileError below

    Exit Sub  '' you are done, so you don't want to fall into 
              '' the error section

    
FileError:
    On Error GoTo 0
    '' do what you need to do if the file did not open
    '' which includes checking what the error was and 
    '' processing accordingly
End Sub
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

:icon_cheesygrin:

Someones' sig here i think:

There are 10 types of people in this world. Those who understand binary and those who don't!

I had that at one time...

Here's something I found back in the 80's:
========================================
Creators Admit Unix, C Hoax

In an announcement that has stunned the computer industry, Ken Thompson, Dennis Ritchie and Brian Kernighan admitted that the Unix operating system and C programming language created by them is an elaborate April Fools prank kept alive for over 20 years.

Speaking at the recent UnixWorld Software Development Forum, Thompson revealed the following: "In 1969, AT&T had just terminated their work with the GE/Honeywell/AT&T Multics project. Brian and I had just started working with an early release of Pascal from Professor Nicklaus Wirth's ETH labs in Switzerland and we were impressed with its elegant simplicity and power. Dennis had just finished reading 'Bored of the Rings', a hilarious National Lampoon parody of the great Tolkien 'Lord of the Rings' trilogy. As a lark, we decided to do parodies of the Multics environment and Pascal. Dennis and I were responsible for the operating environment. We looked at Multics and designed the new system to be as complex and cryptic as possible to maximize casual users' frustration levels, calling it Unix as a parody of Multics, as well as other more risque allusions.

Then Dennis and Brian worked on a truly warped version of Pascal, called 'A'. When we found others were actually trying …

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

I assume you mean you understood my post. OK. Then you understood that

I'd recommend storing only leave days taken. The other two can easily be calculated when you need the values.

means the only value you store in the database is the number of leave days already taken.

So, when you run the report, calculate
1) the number of leave days allowed since hire
2) subtract the number of days taken
3) display what's left as the number of days still available.

And since you have read the link, you also understand why we are not posting code... If not, I'll explain further.

Also:

I'm new with VB ...

By the way, I' new with the VB.

Please bear with me as I'm new in using the virtual basics.

Is there some reason you keep beating us over the head with your newness? It's not that we don't care if you're new. We will help you without you having to remind us all the time... :icon_wink:

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

What's ginger? Isn't that a low-alcohol beer?

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

Please Read This

I'm having to decipher what you are asking, which means I dont understand the question fully. Please explain exactly the scenario so we are clear -- after you read the above link.

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

Solve what? It's C++ code. It's long. It compiles -- or not. Are we supposed to figure out what it's supposed to do?

Advice?
read this and this

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

But there's no requirement that the size of a long be related to the size of an int provided that both meet the minimum size requirements.

Which kinda sucks when you want longs to be longer than ints :icon_wink:

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

Dont use void at the main part.

Even I had trouble trying to figure out what this meant :icon_wink:

What he means is this

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

Initially, your help is:
Read this
and this

You have to figure out somehow what hot and cold means in relation to the answer they have at the moment. Once you decide that, write down the steps needed to calculate the hotness they currently have, then convert that to code.

It's your choice how to define the terms, that we can't really help you with.

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

The dates and day are coming from :

1. Starting Date(x) : The date when the member started working,
2. Adding days per month(y) : Are days that are leave days added per month to each member,

This you can easily calculate from the start date to the current date. I assume you can handle this one. Look at the months for your calculations.

3. Present Date(z) : Is the present date,

Yes, the function Date() will return the present date

4. Given Days(i) : Are days that the member take when going on leave ,

Is this a value types in, read from the DB? Either way, it gets specified somehow.

5. Remain Days(j) : Are days that the member will have left after taking a leave.

Now subtract the value in #4 from the value in #2

The result I want to store and desplay in field that will deplay the total leave credit days a member has on the form that will deplay his/her personal details.

From the above you have:
Total leave days accumulated
Leave days taken
Leave days left

I'd recommend storing only leave days taken. The other two can easily be calculated when you need the values.

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

A lady brought a pigeon to the vet and laid it on the examining table.

"Please do something for Cuddles! He's sick"

The Vet looks at the bird and tells her "Sorry, the bird's dead"

"No!! He can't be! Do something!"

Taken aback, the vet tries birdie CPR and artificial respiration. Nothing. "Sorry, Ma'am, he's a gonner."

"You DO something! Fix Cuddles"

"Ok", sighs the doc. He goes into the back room and brings out a huge Black Labrador. The Labrador puts his front paws on the examining table and sniffs the bird up and down. After a couple minutes, the dog turns and leaves.

"See? Nothing."

Not quite believing, She sobs, "you gotta do something. This is my Cuddles."

Resignedly, he goes into the back room again and returns with a huge Calico Tabby. The cat circles the bird a few time, sniffs a couple times, circles again. Bat's at the bird with her paws, looks up at the doc, and jumps off the table and disappears into the back room.

"See? Nothing. You have a deceased bird."

Finally believing, she says "OK. I guess Cuddles is really gone. How much do I owe you?"

"$150.00" says the vet.

"$150.00!!! Are you kidding? Just to tell me Cuddles is dead?"

"Well, it would have only been $25.00, but after the Lab test and the Cat scan..."

Geek 8-) commented: haha +1
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

maybe I should update now...

http://img.photobucket.com/albums/v281/jacknight/Picture1-7.png

you guys just can't compete.

Did the bunny get hurt when you finally missed?!?? :icon_cry:

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

Testing. Testing. 001 010 011 100...

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

Didn't know it was a contest:icon_smile:

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

Those are great arjunsasidharan!, Thanks

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

Dang site actually crashed my 'puter!!!!

>why did i get a bad rep?????
Because it had no relation whatsoever to the original topic.

It was on topic. His comment related directly to the site under discussion. Apologize....:icon_twisted:

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

anyways!
I really like daniweb.

Me too...

I really like taco bell, getting ready to eat it now.

Ewwww!!!!

I love my bf.

Hope so!

I LOVE HALO.

I used to have one. Traded them in for a couple of horns. Nice red ones.

And I definitely like this thread.
It rocks. ;o)

It's OK. A little kumquatty if you ask me...

But I love taco bell. I ate it today.

Gross! Try something with a little flavor -- like Taco Johns. They Taco Bravo is great!!!

I love high school. I don't really feel like leaving.

Well, stop getting good grades and you can stay. No wait, this is America. They'll pass you anyway.

arjunsasidharan commented: hahahaha... :D +2
Aia commented: The horn things made me laugh. +2
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Ouch... I think I need to talk to my wife!

WolfPack commented: g00d luck. h0p3 y0u g37 l41d. :D +7
arjunsasidharan commented: good one :D +2
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I've been a fan of OIs since grade school.

And if you want to be really impressed, check out Julian Beever's work! Look at the Anamorphic Illusions. They are incredible!

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

Oh, this makes perfect sense! I can explain it very easily....

N R A

:icon_wink:

christina>you commented: ;o) +9
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Not me.

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

Another song that really exists (honestly)

Drop Kick Me Jesus Through the Goal Posts of Life!

See, told ya!
And if you really want to sing it, check here.

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

Also, please read the Rules so you can make good posts with useful titles and questions.

Salem commented: Quite so. +7
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

The way you are doing it works well, especially if there are more numbers in the array.

And we'd rather have a long title that tells us the topic of the post rather than the usual "help me" or "What's wrong with this urgent" junk titles. So thank you for your long title. :icon_mrgreen:

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

Hello,
iam having trouble with reading a text file that contains , [ ]
eg. 3715,4[9]
4356,3[7,3]

char c;
     int events[12][12];//[row][col]
  ifstream infile;
  infile.open("test.txt");
     while (!infile.eof()) 
     {
        for(int j=0;j<12;j++) 
        {
                for(int k=0; k<12;k++) 
                {
                        if(c!=']') 
                        {
                                   infile >> events[j][k];
                                   infile.get(c);
                         }
                         else events[j][k] = -1;
               }
        }
        
        infile.get(c);

     } //end while
     infile.close();

for some reason it doesn't jump out of the k loop. j always stays 0

Thanks.

For one thing, c is never initialized to anything so the first time you test it for ']' it contains garbage.

Next, you use while (!infile.eof()) which is also a bad thing, as explained here ( feof() is the same as .eof() )

Outside of that, I'm not sure what's going on. underjack may be right.

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

Please use the PREVIEW button before SUBMITting your post so you can see yourself if it's readable...

Your errors are telling you to look at the definition of the function and see what you should be passing, but you are not. You are passing a pointer when the function wants a pointer to a pointer

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

> And can the comment box be a required field when giving reputation?
Why? Sometimes I just want to give someone kudos for a good post without having anything more to say.

That's fine. But I'd be interested why someone gave bad rep on an innocuous post.

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

Test the value for 48 ('0') through 57 ('9')

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

With all due respect Ancient Dragon, I think you should get your facts checked before berating someone, what with your stature here. It doesn't look good.

and berating someone for making a joke (note the smiley he used: :) -- that's a BIIIIG clue) looks worse.

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

First of all, please format your code. It's nearly impossible to follow.

Firstly, I am currently taking in the names in the text file into a string and the problem with this is when there is a name with a format such as: "J. p morgan" because i have set aside only two strings, one for the first name and one for the second name, and so when the program attempts to read such a name, the next line is not read in correctly.

You can't use >> when reading a file with evil syntax like you have. Read an entire line using getline() and write a function to pull out and convert all the bits and pieces by looking at the line character by character.

And finally, the last lines in each list is stored twice for some reason in my output file.

Generally this is a problem with using .eof() when you loop through the file for reading. This is what happens, feof() is identical to .eof() .

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

OK, how does someone give reputation that's gray? What does it mean?

And can the comment box be a required field when giving reputation?

Serunson commented: My rep back to ya :P +4
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I prefer the color syntax, but without line numbers. And I do like the yellow box to differentiate code from post.

I also use exclusively.[code=c] exclusively.

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

If others weren't using similar icons for different purposes, it might be clear. But a pencil is "edit the post" on eBay and A&E, and a checkmark means "you have posted" on another site.

Good point...

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

To pause use system("PAUSE");
and #include <stdlib.h>

No, do not use system("PAUSE") . Here's why

Aia commented: Always helping people. +2
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Also, "are not stored correctly" does not give enough information. Explain what actually does happen, because the result of the error may be important to understanding the problem.

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

You can use cin, scanf, gets, getline and so on for reading a string from an input.

The only appropriate function listed for reading a string is getline(). All the rest have problems reading strings, from stopping before the full string is read to potentially crashing the program. I'd also add fgets() as a good function.

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

Where is the deception?

Even though the world is only 6000 years old (or whatever the current Creationist theory is), the scientific record has been modified by God's hand to show 4 billion years. And even though dinosaurs existed concurrently with man, the scientific record has been divinely altered to show dinos died out 60 some millions of years before man arrived on the scene.

Looks like deception to me.

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

Now all I need is for someone to come up with a solution to my gout my day will be made.

Amputation worked for me! :icon_twisted:

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

"Recent supernova?!?!?" It happened some 240 million years ago! :icon_twisted:

That's freakin' kool!!!

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

PETA is a real PITA :)

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

I also thought of an idea that I didn't mention earlier. Someone that truly believes the bible word for word would say that God is so powerful he spread the waters of the Red Sea, sent the plagues (however it's spelled), gave a son to the world that could turn water to wine, etc. If you believe all that is true then obviously God can bend and break the rules of science, being the creator of those rules. How else could He do those things? Knowing that, He could have put fossils in the ground, changed the structure of the layers of the Earth, created organisms alike and made it appear as though evolution were possible. That would seperate the true believers from the nonbelievers. It's a stretch but it's possible.

Yeah, it's a real stretch, and only true if you subscribe to the concept of a deceptive God -- a lying God, as I already mentioned here

I thought you believed in an honest God, not a deceptive God!

The more accurate question here would be "why would he falsify the records like that?"

IMHO, I don't think science has the answer to everything. It lacks in different categories.

Duh! That's why there are still scientists. So they can fine tune what we know, and eventually answer those questions we don't have answers for yet :icon_wink:

And for me, I'd rather believe in God and let him take care of the science. :)

Luckily, there are those that would …

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

I think gas prices will probably go down if a Democrat gets elected in '08. It seems likely after people's dislike of Bush.

Thanks for that. I needed a good long chuckle.

Agreed. Young folks just don't have the history us old-timers have...

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

I'm going to Cedar Point next Friday with my Physics class. It's great cause there are no lines. Everyone's at work or school. But their new roller coaster The Maverick messed up on one of its last test runs. It won't be running for a month so we won't get to ride it.

We used to make the trip to Cedar Point from Detroit once in a while. At the time we had Bob-lo Island in the middle of the Detroit River. We had to pay to get off the boat because it docked on the Windsor side of the island.

Cedar point sounds like a great trip for a physics class! Think of all the experiments you can do!

Wow, I've always wanted to go to Cedar Point, and so has my boyfriend. He has been begging me to go there with him this summer. But I'm afraid it's a bit too far away from where I live.

If he's driving, who cares?!?! GO!

I've heard King's Island was better than Cedar Point. Any one know if that's true? I see it's now owned by Paramount... Weird.