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

You might want to post the entire code again. It's easier to tell you what went wrong in this case when you've posted all the properly formatted code

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

I see. You don't understand the internet and how links work...

Try reformatting your code correctly and you will probably notice a problem. See this

See that underlined text? That is a link. You are able to click on it and a new page will be displayed that describes formatting techniques. Apply those techniques to your source code.

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

Sound to me you should talk to your instructor and find out what you missed. He's in a better position to give you the help you need. All we can do is answer questions you ask, but we're not in a position to teach you what you missed.

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

Yeah, so?

What is int main(void) supposed to do?
How about void menu(void) ?
Is there a reason for int getChoice(void) ?
etc.

So start with what he wants. Figure out what the functions are supposed to do. Add code in short segments. And compile often.

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

I repeat:
Did you add output statements to see if important steps of the process have done their job correctly?

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

You know you can't define a function within another function, don't you? If you properly format your code, the error will jump out at you immediately.

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

And if you read my post you'd see that this can be done without storing any numbers at all -- no arrays, vectors, heaps, nothing. Just read and test, read and test....

1) And if I didn't read your post, how would I have known you suggested a vector? :icon_wink:
2) After 4 years and 5000 posts, do you really think I can't tell a homework problem by now? :icon_rolleyes:

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

You obviously didn't bother to read the links I posted. I tried to help....

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

plz help , whats wrong in the code ??

Here's what I see wrong:
1) Bad formatting, making the code hard to follow (see this)
2) Using system("pause"); (see this)
3) Incrementing the FOR loop counter within the FOR loop.

The first two are not quite what you were looking for, but they are what you asked for.

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

It just doesn't work? Then you did it wrong.

When asking for help, be specific. What does it do instead? And try to pinpoint where the problem might be.

Did you add output statements to see if important steps of the process have done their job correctly?

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

Yes, everything you tried returns what was typed. That's what input functions are designed to do. If they don't,
1) You used the functions wrong
2) Your compiler is acting strange

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

You're right, I missed the array part. But if he can't use an array, why would a vector be OK? Isn't it just a high-faluting array?

That's like saying if you can't use a loop, use recursion... :icon_rolleyes:

After each input, check to see if it's the highest/lowest so far...

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

hai
can any one help me to write the codings for hospital management in visual basic on basic forms of bloode donation list,admission form,etc

Since we aren't medical professionals, not with the information given. But we can help with the coding when you get stuck.

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

I don't understand why people (sonsofliberty84) insist on difficult solutions to simple problems, but many people like to water their lawn by blowing up the dam.

A simple array, a simple loop, 2 IF statements, and formatted is all you need. No vectors necessary.

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

Here's an example of what the page looks for blud, our sysadmin: http://www.daniweb.com/certificates/stats.php?u=6790

He has a respectable 546 posts under his belt and has solved 18 threads to rank #420 for solving threads. But it might be encouragement for him to see that he only needs to solve two more threads in order to jump up to rank #389.

Except solved threads are 'controlled' by the OP, not one who answers a query. Unless you're suggesting blud find an unsolved thread and click it to solved himself :icon_twisted:

As far as newbies are concerned, the ranking statistic makes the system a little more comprenehsible. For example, a newbie might see that a member has 1,000 reputation points, but has no idea whether that is considered a lot or a little in our system. Being able to see where they actually rank (i.e. top 10 or top 10,000) makes the number all that more meaningful.

Even better, if 3 members attempted to help him, noticing that 1 is in the top 100 and the other two are 843 and 1224, maybe the first member has better creds and might have better suggestions. Not always, but generally :icon_wink:

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

Still can't read the code with 20 TABs for indentation.

Convert all your TABs to 4 spaces which is a standard spacing for code. You might want to see this

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

You sure typed a lot of stuff, but I can't figure out what your problem actually is. It sounds like you tried every type of input possible, and nothing does what you want. So explain what you want, not just what didn't work.

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

Reformat... That's one of the most important parts of programming.

Rather than waiting 14 hours you could have done it in 5 minutes,

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

Try reformatting your code correctly and you will probably notice a problem. See this

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

I have a working c file which count lines from a text file.
Is there a function that filters out lines with comments(lines started with //)?

So when I load in a text file with a c code, it only has to count the lines without comment.

No. That's the beauty of C -- you get to write all the filter functions yourself so they do exactly what you want.

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

Is length of str1 less than length of str2? If so, exit with not found.
Look through the characters in str2 for the first character in str1.
If not found, exit, otherwise...
Are the next chars in str2 the same as str1?

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

Neither are we. You didn't describe the problem. And most people will not download attachments.

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

Yes, you are wrong. Look closer at the name of the function -- getline(). Look up I/O techniques, try something, and if it doesn't work, post what you tried.

One technique is to read a character and save it, read another and ignore it, read the rest of the line. Many other possibilities are available, too. Try something...

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

What help do you need? When you ask for help, you need to describe a problem.

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

Of course I'm serious...

Where is your attempt at numbers and capital letters? It's identical in concept with what you have for lower case. If what you tried didn't work, post what you tried so we can help you fix it. Otherwise all you are asking is for us to do it for you.

We help you write your programs, we don't write it for you. And I've given you help. You have to show us why our help didn't work, not just claim it didn't.

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

Then you did it wrong. And since you didn't bother to show is what you did do, there's not much to help with.

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

Could anyone help by telling me how I can add to it so it also counts upper case letters and also numbers 0-9?

What does

for(char ch='a'; ch <= 'z'; ++ch)

do? Maybe something similar would work?

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

But not this time -- OK...

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

Never -- NEVER -- NEVER call main() to return from a function!!! Never!!

Modularize your program. Create subroutines that do a single part of the task and call them, like
1) Generate the list of numbers
2) Read the list
3) Test for palindrome
etc.

Then you can work in short sections at a time.
As for your sort problem, I see nothing that sorts at all. Nor can I see a reason to sort.

Also, for the sanity of your user, get rid of all the system("cls"); commands...
And the system("pause"); commands -- see this

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

Absolutely. Come up with an idea and we'll help you fine tune it.

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

My apologies. I simply thought someone had a problem and needed help.

And you were correct. As the OP stated "I need help with this assignment,..."


Is this (site) all about helping students or is it about programming problems generally ?

Both. But it's not about writing code for someone. It's about helping them solve their own problems and thereby learn.

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

Intrade, this is why we don't tinker with people's code and post the answer. You just finished the program for him and he passes on your work, not his.

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

Stop bumping your thread. It's rude! We are not staff waiting to answer your question, we are volunteers that have lives. We'll get to you when we log in and have an answer for you.

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

Consider:

Assume that the first integer read specifies the number of values remaining to be entered and that the first number is not one of the integers to compare.

What is the purpose of the first number to be read? How would you use it?
What is the purpose of the 6 in your while statement?

Write a program that finds both the largest and smallest of several integers.

How would you do this on paper?


To chief427:
What grade to you expect to get for your code? What grade should lou38 get using your code? Please do not give working programs to students. We help people solve their problems so they learn, not write the code for them so they can cheat.

csurfer commented: Daniweb described in simplest words :) +2
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Well, you open a file to read, then you read the data from the keyboard -- that's what cin does.

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

First thing I'd do is create a function that simply outputs a board and call that instead of hard coding it in other functions.

Then, add output statements to follow your program (or use the debugger) to see where the problem shows up.

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

Without knowing what the error is and where the error is, no.

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

Sorry about that, I think I'm at a point where I don't understand enough about the code to be able to explain my problem.

But, I do have another question: Does the fact that this was made for Linux have anything to do with its not compiling on Windows? I really don't know anything about these types of things; I thought C was C wherever you compile it.

Yes, C is C -- if you write code in Standard C. If you start using additional capabilities beyond the standard that most compilers add in, all bets are off.

Look for a compiler switch that turns on ANSI Standard to flag anything that you use that's not standard.

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

Load the appropriate properties from the drivelist into the filelist properties when you change the drivelist.

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

If that's true, then more detail is required. When asking a question, ALWAYS give enough detail for us to understand the problem. Remember, we can't see your computer, your code, your errors. If you don't explain in detail, we can only guess -- generally a waste of our time, and certainly a waste of yours (at least 12 hours since your last post).

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

1) Do not bump threads
2) Give enough information for us to understand the problem
3) Read the Member Rules

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

Neither do we since "an error" is a useless explanation of the problem and there is no formatting at all making the program hard to follow.

See:
this, this, and this

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

Search the web for file i/o function tutorials.

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

You cannot use a variable in an array definition.

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

How do I fix what I did? I don't even really know what I did wrong.

That depends completely on what seems to be wrong now. Care to elaborate?

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

Use CODE Tags!!!!
No code should ever go into a header file. No variable definitions, either. Why you want to copy your entire c-file into the h-file is beyond me, but that's your problem.

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

Error C2057: expected constant expression
Error C2466: cannot allocate an array of constant size 0
Error C2133: 'inc': unknown size

Why? Here's the code:

What lines?

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

Where do you output the first day of the month?
Do you know what day of the week this first day is?
What can you do to move that 1st day under the correct day label before you output the first day?

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

There is no information in your description that we can even guess at the problem. Try looking at the code that generates the message and see what conditions prevent the data from being loaded.

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

I've said it before -- I'll say it again... Jeez!!!

The problem you are having is with the digital limitations of floating point values. They are not exact. When you keep adding 0.01 to a value, a small error will creep in because floating point cannot represent all numbers with precision -- it's the problem with digital representations. The 'thousandths' you see is just such an error.

If your precision is 0.01 then this error is negligible so you don't really have to worry about it. Just limit the output to 2 decimals.