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

Oh, c'mon, jonsca

You will need to either tokenize the lines and get rid of anything after // or between /* */

-or-
You can write a finite state machine similar to the ones that a compiler would use...

-or-
You can use a regex library...

He said

Totally new to C++, so please forgive me...

He can't even find a double quote in the line he's read, how is he going to add a regex library, or even know what a state machine is? I myself never heard of a state machine until my girlfriend was getting her masters.

Know your audience...

Sheesh! :icon_wink:

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

If you type in 0 and 0, what are the value of a&b at the end of the while loop? That should help you figure out the two numbers to enter.

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

Please explain why you need sem.h. Who told you?

Where did you get the code? What compiler did they use? What OS?

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

In order for the functions in the header file to work, you need the code that is actually behind the function. That code is found in a library file.

Look at it this way:
The header file is like the phone book. It gives you the people and address of their house. But it's only an indication of where to find the house. The library file defines the house itself. How big it is, how many people live there, number of trees in the yard, ect. Without the existence of 'the house' the phone book isn't really useful.

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

What if i need them to be in the same program, what should i do?

Figure out what you're trying to accomplish and think carefully about how you can put the code together into one file. It may mean a if() statement or two, and another question to the user.

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

English is hard enough to pronounce without involving foreign derived words as well.

One of my favorite questions on the topic - how many different ways can the syllable "ough" be pronounced?

Or my 2 favorite words -- from George Bernard Shaw:

GHOTI
GHOUGHPTEIGHBTEAU

Both very common English words simply written 'phonetically'

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

01011001 01101111 01110101 00100000 01110010 01100101 01110011 01110101 01110010 01110010 01100101 01100011 01110100 01100101 01100100 00100000 01100001 01101110 00100000 01110110 01100101 01110010 01111001 00100000 01101111 01101100 01100100 00100000 01110100 01101000 01110010 01100101 01100001 01100100 00101110 00100000 00100000 01000010 01110101 01110100 00100000 01110100 01101000 01100001 01110100 00100111 01110011 00100000 01001111 01001011 00101110 00100000 00100000 01000111 01100001 01110110 01100101 00100000 01101101 01100101 00100000 01110100 01101000 01100101 00100000 01100011 01101000 01100001 01101110 01100011 01100101 00100000 01110100 01101111 00100000 01110111 01110010 01101001 01110100 01100101 00100000 01100001 00100000 01110100 01110010 01100001 01101110 01110011 01101100 01100001 01110100 01101111 01110010 00100000 01110100 01101000 01100001 01110100 00100000 01110111 01101111 01110010 01101011 01110011 00100000 01101111 01101110 00100000 01100001 01101100 01101100 00100000 01110100 01101000 01100101 00100000 01100110 01101111 01110010 01101101 01100001 01110100 01110011 00101110

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

in C/C++ the square root of a number can be calculated using the pow() using 0.5 as the second parameter.

Isn't sqrt() available?

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

Read a line. Check if the line contains the number (at the beginning) or the text (at the end). Since you're using character strings, the strxxx family of functions will help. Also, you can look at each individual character in the array/string.

Also, in Englis, there is a space after each period, comma, question mark, etc. They are there for readability, not just to annoy the writer :icon_wink:

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

I'd recommend going to a shop that custom builds computers and you can explain what you want and they can match the computer components to you needs. They will also give you good service (generally) -- at least much more than Dell, Gateway, etc.

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

Well, with the help above, I'm certain you can figure it out. You know the format of the file, you know what you type in at the prompt. From there, AD's code has a bunch of what you need. Just add to that what you already know.

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

Yeah right.
Just was pointing out the great difference in pronunciation between Detroit and adroit.

Actually, they are pronounced the same given the difference in the beginning letters:
adroit: \ə-ˈdrȯit\
Detroit: di-ˈtrȯit, locally also ˈdē-ˈtrȯit

Unless you mean something else...

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

Oh, why not. 1, 0, 1, 3.14

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

Not bad for a first day. One thing you need to learn right away is this, though.

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

OK, I did it. Now it's your turn.

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

Sure. Stop hijacking old threads. Read the Forum Rule. Check out the Sticky Posts before posting again.

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

Are

other webpages of huge sizes and txt file[s]

binary files? I suspect not. strcat() is only useful on text, not binary information. nezachem is correct because an image is binary. You need a different way of processing non-text information.

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

Brief fix! For something posted 6 years ago? Not brief enough...

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

Do't know why I didn't think of that... Thanks again...

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

Why do you think it's homework may be s/he is just trying to learn something but don't have idea how to solve it.

  1. Instructors do not write the answers to homework problems on the board before giving out an assignment. Only after the assignment is done.
  2. Instructors frown upon copying answers from classmates preferring you to do your own work.
  3. Instructors frown upon students asking other students to do homework for them.
  4. Instructors generally don't mind if students help each other, short of turning in the exact same work
  5. Students are expected to do their own work and ask questions that help them understand the material.
  6. Plus more....

We are not their classmates. We therefore wish to abide by these expectations. They have been around for centuries. Who are you to say it's wrong?

... but sometimes you first need to see something from someone and than try yourself, at last it's just my opinion it doesn't have to be yours.

So give them something, just not the complete answer.

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

plz guide me i m having some error at line 28

After 48 posts you can't give us a better explanation than "some error." Since you think we're as psychic as you, read my mind for your error. :icon_rolleyes:

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

Whoa! dhanyavad!

No comprende.... If the page changes, I thought the cache would be overridden.

Database :icon_rolleyes: The page istelf was still the same. It was just the database contents that does not get stored in the cache that changed. Ja?

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

Another possible solution is to load your b array with the numbers 1-9. Use rand() to get an index into b and copy the value from b into a .

Now shift all the numbers in b down to overwrite the one just used, leaving only 8 numbers left. The next call to rand() you use 8 instead of 9. Keep doing that until you only have 1 left.

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

s/he is using printf with using namespace std it just proves that s/he is beginner in these and s/he need to learn how to think in c/c++ to be able to solve task like these one and s/he wont learn that by reading some text but looking in code.

Jonsca is correct. You are mistaken.

If you want to show everyone your prowess at coding, give an illustrative piece of code they can learn from. Do NOT write the code for them.

After a whopping 10 posts, you do not yet have the creds to argue with a lowly "Nearly a Posting Virtuoso" (no disrespect intended, Jonsca).

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

Last night in FireFox 3.5.3 I lost the formatting in all of Software Development. The other communities seem fine. I checked Opera and another computer, all is fine. Other websites seem to be unaffected.

I deleted all Daniweb cookies to no avail.

I also have no 'attach files' option for this message so I have to load the image elsewhere

Also, opening the Error Console in FFox, each community displays 24 errors and warnings just opening the page, only 19 for SWDev.

I also don't seem to be able to click on any of the formatting icons above. Ctrl-B and Ctrl-I both bring up the FFox Bookmarks Toolbar.

What does one do in this case (short of reinstalling)? I feel like a cripple...

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

A constant int (i.e. 1) is not an address. It's the value 1. You seem to misunderstand what an address is. Maybe a google search can clear up some details.

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

hello!
just started out here...
i need help with this program
i need to generate a 3*3 matrix having unique numbers in the range
1-9. I did this program using srand but i'm unable to get the correct output...i couldn't figure out the error...could someone plz help me??
here the program

Why is it new people think we're psychic and know what the error you're having is? Don't you think knowing the problem would help with a solution?

All I can assume is you aren't checking to see if a number has already been randomly chosen and loading the same number twice.

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

Now you're in the realm of "what the heck are you trying to do" type of question. Just loading a number into a pointer does not make it an address.
You load the pointer with an address, not an integer.
Explain what you are trying to accomplish, with enough detail for us to understand. You'll probably need to post some example code, too.

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

As far as I can tell, you have no idea what you want to accomplish.

Write down what you want to do in detail. Then break that description into steps.
Break the steps down as far as possible into minute instructions.

Now you have something you can translate into code.

And if you need help here, posting "It doesn't work" is not enough. If you're posting, it's obvious is doesn't work. Details. Enough details for someone that didn't write the code to understand what was supposed to happen and what did happen. Without this, we're guessing.

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

Yes. That's one of the main reasons for having pointers.

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

Hi All,
When I try to compile the code below, I get error message " error: ‘MAX_IMG_HEIGHT’ undeclared here (not in a function)".

Where is MAX_IMG_HEIGHT defined? What's its value?

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

does this make sense

No. What happens when you enter

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

Loop.

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

Use the functions srand() and rand() to roll the dice.

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

Currently, the maximum tax rate is around 33% whereas in 1955 the maximum tax rate was 91%. Whine me another whine.

You need to try understanding the terms you attempt to prove your arguments with. "Marginal Income Tax Rates" have nothing to do with my arguments. Don't just Google a term and use invalid data to justify yourself. If you bothered to check your facts, your 91% was at the top money earners ($400,000+), whereas the lowest was 20%. The majority of the country (middle class) was at the 20-30% level (up to $8000). Try this data instead.

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

Yes, I thought we were talking about the actor. Since the question asks "What is Gallagher's first name?" it could refer to any Gallagher.

Why? What did Peter Gallagher have to do with watermelons?

I saw Gallagher on TV once, what a riot! People in the front rows had to cover with plastic, as he was hitting those water melons on stage with a big hammer.

Keep with the program! :)

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

printf()?

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

Read the file, add the file fruit to the list, output the list back to the file.
Open
Read in loop
Close
Open
Write in loop
Close

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

How to store the data of a program without using registry?

Because I don't want the users change the registry and the program settings...

Are there any other ways that can prevent the users from changing the settings?

Don't open the registry?

What makes you think you need to store data in the registry? That's not what it's for.

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

This is an CPU sheduling algorithm i.e proirity sheduling .It show some error that i can't solve please anyone correct it . its very urgent.

1) This is not a CODE SNIPPET. Do not post questions as such
2) Help Me is a title in violation of the Forum Rules. You did read them as requested, right?
3) How do you expect anyone to follow unformatted code? Formatting is necessary when writing code.
4) Nothing is urgent on this forum. If it's really urgent, talk to your instructor.
5) You expect us to figure out what your error is with no information from you? Presumptuous, isn't it?
6) You expect us to fix your code for you? Contact hire-a-coder.

Salem commented: Excellent +19
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Are you reading a 1) string or a 2) array of characters?
Did your instructor cover either of these?
Whichever one you are using, do you have any idea how to tell if the word Store is in it?
If your instructor and/or book covers them, now is the time to read the notes/book to understand them and the functions involved.

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

Sorry, you were wrong. The other loop with getline() was the proper start. You just have to think about what you are trying to accomplish.

Write down on paper what you are trying to do. Step by step. Detail by detail. Read a line. What do you do with it?

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

I did not ask what if should do, I ask what it does do. In detail. Answer the questions I asked. There were 3 of them.

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

unsigned int: 2 ^32 - 1

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

Stop using scanf() and fscanf() . They won't work for you because of your data, and you don't know how to use them -- which is a good thing, actually.

Please explain this loop:

while (!file.eof() )
{
	string line;
	getline(file, line);
        cout << line;

What does it do? What causes it to stop? How does it handle the Store # lines?

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

All I hear is as long as you don't see the clock tick, time must not be moving...

Your description of bad economy where people suddenly can't afford their life is happening in the States -- just at a slower pace.

When I was a kid, one parent would work and the other parent could stay home.

That is not true today. In most households both parents must work just to keep their head above water. And in only 50 years. And if you take a close look, it wasn't a linear change.

It's not going to be long until 2 incomes will not be enough. How many families do you know right now have in fact 3 jobs just to get by? An anomaly or a symptom?

Is this the government's doing? Not completely, but a good large chunk of it. At a minimum, they are the ones that add and raise taxes without seeming regard for the people they are governing.

How many new taxes and tax increases have you yourself voted for?
And what is the current count of taxes we are paying daily?
Are these numbers even close to each other?

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

Why not just int a[100]; Or, knowing the limitation of int just declare the array as int a[41]; and save the time and processing to input a value and call malloc() ?

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

Why not? What was it supposed to do? What did it do? How does it handle the .DBF file format?

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

Are you implying money today is worth something?

"I don't want to overthrow the government. I wanna fire 'em."
-- Gallagher

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