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

Look up how malloc() and free() work

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

Not fair, deceptikon -- giving me rep and taking it back! Positive rep, even as a test, is a good thing! :P ;)

On a serious note, I hope you aren't planning on changing the wayt the box and arrows interract. I happen to like the way they work now.

Oh, and the comment you made was left in my list of rep even after you removed it. That might be a bug...

deceptikon commented: I'll return it to you. ;) +0
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

What type did you enter with scanf("%c",&option);? What's the binary value of the input?
What type did you compare with case 1:? What's the binary value of the test value?

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

Is fputc() used to save in files?

Yeas it can. But is it appropriate for your program? What did the tutorial tell you to do?

I know the logic d above u wrote,I actually want the syntax to store it in file after comparison

Of course you do. It's always easier to have someone else do your homework for you. But, unless some bumpkin comes along, you'll have to actually learn to do it yourself.

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

I'm sure the book didn't mix up operators.

Actually, yes it did. The statement is wrong in the book -- at least the PDF I have.

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

this is a code from the book "the C programming language" by dennis ritchie

I'm looking at the code in the book right now. Your code doesn't look like the code in the book. They wrote the code with indentation so that it's easy to follow.

Look at the big IF statement. 2/3 of the statement is good, but 1/3 is wrong (it's wrong in the book, too). What do you see that's not consisent? I velieve if you look closer, there is either an error or warning for that line.

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

And your question is....?

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

What is the result of 10 % 10? How can that answer be used to output the value you want?

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

Last time you told me sloppy coding isnt serious lol.

That's not at all what I said. I said "Don't apologize for sloppy coding. It only takes a minute or two to fix formatting." That means make it unsloppy so you don't have to apologize. And so we can read and follow it.

and i dont understand when i would flush my input?

Any time you do an input and don't read everything from the stream. Such as typing in "N[enter]" and reading a single character ('N') and leaving the '[enter]' in the stream for the next input.

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

Please format your code so we can follow/read it

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

I use the undo option when I decide I want to remove my vote, not because I accidently added a vote.

I still think it would be a good idea to change the dropdown (wording) to know if you've hover over an up or down arrow...

No it wouldn't. The comment I made above to the Good Reverend I hovered over the down arrow simply to open the input box. I then clicked the up arrow. I think it would be a bad idea to indicate which arrow initiated the box since it is immaterial. You can click the other arrow to save.

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

You'be been told before about formatting your code properly.

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

Why is it so hard to explain what is wrong for you noobs? We are programmers, not psychics. Tell us what you need help with!

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

Keep in mind that I'm working within the constraints of a very awkwardly designed parser for the editor, as well as multiple third party libraries around highlighting and formatting that need to be kept in sync.

So we traded the below par VBulletin for the below par parser? I assume a slickly designed parser will be coming eventually. Or is that not in the cards?

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

1) Do you actually know what fflush(stdin); does? Read this

2a) After you execute a function, what do you do with the string?
2b) How do you know it doesn't do it's work?

Follow the code carefully.

3) If you would format the code consistently, other problems might show up that we can't see.

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

Looks to me your compiler isn't set up correctly. Other than that, I haven't a clue. Maybe reinstall?

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

No, they are not blaming anybody. Sanjay explained that because of the change in the site, the spellchecker can not work as it used to and no fix has been implemented to correct it yet.

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

NEVER use the word urgent in a forum. There is no urgency as far as we're concerned. And many people will simply ignore your post.

And you need to be more specific than "it doesn't work". If you want help, and fast, the more we have to stare at 300 uncommented lines of code trying to understand it, the longer it will take to get an answer.

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

Then reread the section on writing functions.

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

What he means is the problem, as you described it so far, has nothing to do with C++. You have to have actual code for it to become a C++ problem.

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

And we're supposed to read 309 lines of uncommented, unformatted code and do what with it?

Try adding more output statements at key places (top/bottom of functions, in loops) to pinpoint where the problem is.

And format your code properly. If I have to read it, I have to be able to follow it.

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

I get a bunch of errors and dont really know what to do. Any suggestions?

Sure. Fix them. The errors tell you what line number and what the problem is, so look there and correct it.

nitin1 commented: :P +1 +2
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I'm not convinced that it needs to be relocked anyway, given that the argument is over 5 years old and the participants are no longer active.

After 7 new messages, none of which are helpful, you can say that? OK, point learned.

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

but why it is necessary to have a checking crietria ? I think we just need to convey our message

ey'll shoow ewe eyo. duz ts cuvay teh msesje eym treyngg tewo siay?

np complete commented: LOL :D +0
nitin1 commented: wow! so we need to laugh ? :-o +0
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I dont get why the arrays were in the way though.

What are the legal values of x when using total[x] -- defined as int total[12];

And no i really dont get how srand works, lol.

ha ha, that's funny!!! I wish there was a way to find out. I can't think of a thing. Can you??? 8)

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

I really dont understand any of this...

OK, translation:

You are going to convert feet and inches or pounds in this program.

You will write a conversion program that converts feet into inches and inches into feet. It must also handle pounds (presumably into ounces).

You will give the user the choice of converting feet and inches to centimeters OR pounds to kilograms.

Oh, unclear above.
OK, you will enter feet and inches and convert that into centimeters.
Or you will enter pounds and convert that into kilograms.
You will also have an input that asks the user whether input is in feet or pounds.

With the correct answer you will also display the number entered.

Once you make the conversion you must display the value entered as well as the conversion value calculated.

You will also create the program 3 times, once for each of the basic loops (counting loop 5 itterations, while & do-while as many as the user wants).

Make 3 programs, one for each type of loop defined in C++.

Don't forget to check the UPPER and lower case letters.

If (when) you enter characters instead of numbers, check if they are upper or lower case and handle them appropriately.

This means you will have 3 Visio files to zip and turn in.

Make 3 Visio files and zip them. Turn them in, too.

Hope that's clearer.

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

Since The Dragon closed this thread 5 years ago, I'll close it now.

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

Do you know how to load a value into datagrid row1 col1?

Just load the .text of the textbox into the location you need with an =

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

Unfortunately if you'll notice,

How would we notice? It's just a box ;o)

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

Actually, formatting the code is the first step. The second step is fixing the compile errors.

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

There is no need to read more than one record.

OK, sorry. didn't realize you only wanted to read the file once and input only the first username and password.

When I try to log in, it only accept admin1 as username and password1 as password.. If I try to log in using admin2, the program will return 'Invalid username or password.' instead of the welcome.

But you said you only wanted to read the first username and password! Make up your mind!!!

Are you under the impression readUserLog >> temp; reads every username at once?
Do you really think that if(userName == temp && password == temp1) tests every username from the file with the userName entered in one single statement?

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

Don't downvote a post to ask your next question. Post it properly.

what next level would you look at, it is passing the error check. I dont understand why it would not work...

You opened the file and didn't check for an error. Logical extension:
What's the next thing you do that might not work? Did you check for an error there?

Try adding output statements to make sure your program gets where it should, and variable you need have the proper values.

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

You only read the file once and you're done. What do you need to read more than one record?

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

Don't apologize for sloppy coding. It only takes a minute or two to fix formatting.

Why is it so many people think that seeding the random generator should be done immediately before calling rand()? Doesn't anyone read the info about how srand() works?

Why do you have all those arrays of 12 and load the 13th entry in the array (which doesn't exist)?

Reformat and think about how you are using the arrays.

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

OK. What syntaxes?

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

Extend my question to the next logical level...

rob.brown.315080 commented: what next level would you look at, it is passing the error check. I dont understand why it would not work... +0
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

How do you know the open file worked? You never checked for errors.

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

He gets my sudent rate... ;o)

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

My rate is $100 per hour.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
int main (){
    getinput();
     int i,j;
     for(i=0;i<strlen(expression);i++) 
     {
                                        printf("\nstrlength=%d--------for i=%d\n",strlen(expression),i);
                                        c=expression[i];
                                        switch(c)
                                        {
                                                 case '+':
                                                 case '-':
                                                 case '*':
                                                 case '/':
                                                 case '^':
                                                   {   temp=(NODEPTR)malloc(sizeof(struct node));
                                                      temp->item=c;
                                                      temp->rnode=pop();
                                                      temp->lnode=pop();
                                                      push(root);
                                                   }
                                                      default :
                                                    {  temp=(NODEPTR)malloc(sizeof(struct node));
                                                      temp->item=c;
                                                      temp->lnode=NULL;
                                                      temp->rnode=NULL;
                                                      push(temp);
                                                     } void free(void *ptr);
                                                      break;
                                         }
     }
     root=pop();
     inorder(root);  
     getch();           
                                         } 

Could you please explain why you chose the above formatting? It makes little sense to me so I am quite curious.

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

Start by opening the comiler's IDE. Then add #include <iostream>. You can continue from there.

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

What should n be initialized to? Can it be zero? Where do I place the initialation in the program?

If you don't know what n should be, why did you ise the statement
for(i=0;i<n;i++)? Using n implied you know what it is and why.

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

You have 2 questionable sections.

All those strings are defined at least twice. You should make a master list of the strings and use when you need one, use an index into the master list array.

By carefully designing the list, you may (not guaranteed) be able to make your switch much shorter by combining cases and using the index rather than the strings themselves.

Also, read this about formatting. It's a good try, but much to wide.

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

It really helps to format your code so others can follow it. Formatting also helps you when you get an error like "end of file during compile" of "else without if"...

Also, conio.h is non-standard and should be avoided. You certainly don't need it in these programs.

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

Don't use exit(0). Use return 1.

I don't understand the problem you are having. The instructions you posted literally tells you all the code you need to use, most of the variable names and what they are for.

The only thing you have to figure out is
a) how many SPACEs are needed before each level of the tree
b) how many SPACEs between the two sides
Simple subrtaction for that.

Draw it out on a piece of paper (graph paper if you have it) and count.
Then convert those counts into an equation.

Hint1: Work only on the left side of the tree first.
Hint2: Add the right side after you have the left side correct.

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

And format your code properly so we can understand it.

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

When you want to enter a sentence ( that is spaces will be present ) , use fgets().

Don't you mean cin.getline()? This is C++...

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

I'm not a compiler. I have no idea what c2059 and c3861 means. Copy and paste the exact error message, and make sure the line numbers match your code.

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

but i keep getting these errors in my program.

What errors? I don't see any errors posted at all.

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

then why the hell you are downvoting every post ? you must say it in post, rather than downvoting like this. okay!

OK. Please stop derailing everyone else's threads with multiple questions of your own. They are asking for help on a specific question. When you start making multiple posts asking your own questions in their thread, it gets very confusing for everyone.

If you have a question not explicitly related to the current thread, start your own thread. Reference this thread if you want, but ask your question in your own thread, not theirs.

This thread is now much longer because you needed clarification on something that wasn't bothering the OP. You should have started your own thread for your discussion with deceptikon.

And the reason I didn't make a post was for this exact reason -- I didn't want to derail the thread any more than it has been, but you wouldn't let me.

Please be more considerate of other people's threads and their questions.