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

Wouldn't surprise me.

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

2-3 years? Boy, you are new here.

frogboy77 commented: 2.14860807713 years, so 2-3 would be about right +0
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

6. Then type “cd windows\system32” without quotes ...
3. Type the command “control userpasswords2” (without quotes) ...
type “exit” (without quotes) ....

If you don't want people to enter the QUOTES, don't use them in your explanation. The bold or italic text is enough to distinguish the text to enter.

Anyway, do you really think people today need to be told not to use quotes?

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

Try formatting your code so we can read it. It's extremely difficult to follow with the format you gave us.

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

Given this sorted array
1,2,4,4,4,5,6,7,7,8,8
what steps would you take to find the mean sitting at your desk with pencil and paper. Write those steps down. What steps can easily be converted into code? Which ones can't? Those that can't need to be broken down into more steps.

Post what you have and we can help you fine tune it.

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

Please format your code so it's readable. Get rid of all the comments that force each line to be too long.

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

If you read the root post of this thread carefully, soon you will realize the question was to create a command button at run time and then change the color property.

And if you read the thread more carefully, you will see that people have said my code doesn't work. It does. I was pointing that out.

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

Then get rid of conio.h and use getchar() instead. It's standard.

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

Try outputting the values you input, to see if they are correct.

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

According to system function discussion. For me system("pause") is the best way to leave window open for Windows users to see results.

And you'd be wrong.

On my system I just get info in terminal that this command was not found and program finishes normally.

And this is why.

If someone would use appreciated (according to sticky) getchar, or cin.get, I would have to specially input character to finish a program.

So? The character is the ENTER key. What's the big deal?

According to topic system("cls") is in my opinion the best option for beginner programmer to clear screen without having portability issues (of course you can use some #ifdefs and conio/curses/...).

And you'd be wrong again for the exact same reason. You have major portability issues, not none as you state. And since you mentioned beginner programmers, you want to teach them "#ifdefs and conio/curses/..."? Get real!

On systems without cls it will just output non fatal error, that cls program was not found.

And this is acceptable? You've got to be just barely beyond beginner yourself to have this opinion...

If not and you are a professional, ask your boss if it's OK with him if you "output non fatal error, that cls program was not found" is acceptable in your project. I suspect we all know the answer, therefore it can't be the best solution.

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

Ran your code, waltp. said I can't assign a read-only value from code, though. thanks, still!

My code doesn't assign anything to any read-only values. If it gave you that error, you changed my code.

I guess I should have pulled together all the data from the thread:

Make a form.
Add a command button to the form - Command1
Change it's style property to GRAPHICAL (1)
Add to the form code:

Dim clr(4) As Long
Dim idx As Integer
       
Private Sub Command1_Click()
    Command1.BackColor = clr(idx)
    idx = idx + 1
    If idx = 4 Then idx = 0
End Sub
       
Private Sub Form_Load()
    clr(0) = &HFFFFFF
    clr(1) = &HFFFF00
    clr(2) = &HFF00FF
    clr(3) = &HFFFF&
    idx = 0
End Sub

This code works as intended.

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

I'm simplifying for someone that thinks C-strings are the same.

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

But from the meaning of string, string is a something that ends with null character.

In C, you are correct. In C++ you are not correct. In C++, a string is defined via the std:string type. The definitions are not interchangeable.

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

Draw data out on paper. 1 dimension is a row. 2 dimensions is row and col. Try loading a string into it and see what happens.


If you don't understand something, draw a picture.

AndreRet commented: Thanks for the rep today.:) +7
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

By the way, isalpha() only checks for Letters, isalnum() checks for Letters and Digits..

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

You claim to be using a DO-WHILE loop. I see the DO. What's missing?

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

When you make a post and it looks bad, click the EDIT button to the left and fix it!

kvprajapati commented: :) +12
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I don't see any bubble sort in that code. You need to do a little research. Try GOOGLE.

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

There's no way in hell I'm going to look at code with spacing like that. Get rid of the blank lines and add some indentation, etc.

Notice indentation! See this

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

The documentation of the functions themselves. Where did you hear about them?

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

Here's a list of ICODE possibilities:

Using icode-tags on one line like this gives

Using icode tags on one line like this gives

Using icode-tags
on two lines like this gives

Using icode tags
on two lines like this gives

Using icode-tags

on three lines like this gives

Using icode tags

on three lines like this gives

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

I think that a carat is a good idea.

Of course you would, you're a girl. Especially if it had 23 friends. :D

Me, I'd like a carrot.

jonsca commented: Someone had to say it!! +0
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Ahhh, I see. I've never added controls that way. I create one control with an index of 0 and LOAD more as needed. Maybe that's the secret.

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

You actually don't need vbscript to do this. Go to a DOS prompt and type

dir /?

That will show you how to get a list of all the things you need. Try this:

dir *.jp* /s /b > myfiles.txt

This will give you a list of all files (with directory information!) that have .jp* extension (e.g. .jpg, jpeg) and store it in a text file. You can then use a good text editor to add a del statement to each line, or to remove lines if you don't want to delete the files in question. Kind of old-school, I know, but if it's a one-time task, why spend the time to learn a new language?

I agree. But this won't work with hidden folders. But then again, if they are hidden folders, you wouldn't have pictures in them, would you?

Alternatively, look at ZTREE. It will allow you do do exactly what you need with little fuss.

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

okay.. i got u..
well i want to sort the CSV file according to first column..

so what i was thinking that take first column data in floats array.
and rest whole data in other data array..
then will do bubble sort for both of this array...

That will work fine. During the swap, you swap both the float values and the 'other data' values.

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

m a bit confused...how can it b written in C coz again u will need a C compiler to compile it..

Yeah, so? You compile C-version-6 with the compiler C-version-5 and you have an updated compiler.

also if it is written in assembly..then how can the code run on different machines..i mean,assembly language would be different for different architectures,won't it..??

If only standard C is written, the source can be built on different systems which makes them run on the architecture built on. For those things that are architecturally specific, like I/O, different code is written for each architecture.

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

Look up sprintf() . That will allow you to put a string together from different variable types.

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

Hi everyone , I'm learning C for couple of months and now I have a project in which I have to make the snake game in text enviroment !!
So please someone tell me how can I do that and what I need to learn ??

You need to design the game itself.
What are the inputs from the user?
What happens to these inputs (what do they do)?
How is your snake designed and what does it do?
What are the limits of the gameboard (if there is one)?
If there are moving 'things', how do they move and what happens at the gameboard limits?

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

help me..
why data and floats are not being passed in sort function???

They are.
You print statements are wrong, so if you expected a certain output, you won't get it.
You are only printing 1 single value from both A and D. But since i has no defined value, it could be literally anything. It might even be displaying A[2653491554]. I'm surprised your program didn't blow up.

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

If I'm right, stock[0] is never used and it only uses stock[1]-stock[31] as it is using day as it's value.

You're right. And that's confusing. Increment day at the end of the loop. You will then use stock[0] thru stock[30], which is normal. C/C++ arrays are 0-based. It's easier to get used to that than fudging the code.

I still get a segmentation fault if I set the array to stock[31] though.

Remember, the last value usable in any array is one less than the definition. So stock[31] in this case is outside the array, since stock goes from 0 - 30 (31 values)

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

You're kidding.

Just set the STYLE property to 1 and run the program. Then you can change all the colors you want via code. You don't need APIs.

Dim clr(4) As Long
Dim idx As Integer

Private Sub Command1_Click()
    Command1.BackColor = clr(idx)
    idx = idx + 1
    If idx = 4 Then idx = 0
End Sub

Private Sub Form_Load()
    clr(0) = &HFFFFFF
    clr(1) = &HFFFF00
    clr(2) = &HFF00FF
    clr(3) = &HFFFF&
    idx = 0
End Sub
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

So maybe you need to bring the variable count outside of howMany() so the rest of the program can see it. Since it's local to the function alone, it doesn't exist.

And I beg to differ. It does not give you 1 every time. The program doesn't even compile.

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

Is there a better definition of problems? Can you explain what problems mean now? If you changed code, maybe if we know what the code looks like now it would be helpful, especially since we don't know what was tweaked nor how.

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

Would it be like this?

Did it work?

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

can you tell me more about it ???
^_^

Sure

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

Because while (done [B]=[/B] false) sets done to FALSE, so your test is FALSE.

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

I see what I did wrong in questions one and three. And as for number two, my teacher didn't teach us how to loop things in an array. I only know how to use a while command at the moment.

So what is this (after you fix the 32)?

while (day < month)
{
    cout << "What was the stock price for day "<< ++day << "?" << endl;
    cin >> stock[32];
}

And as to why I set the array to stock[32] instead of stock[30], if I don't it gives me a segmentation fault.

It wouldn't give you a seg fault if you'd use the proper values. In programming, you can't just arbitrarily change numbers just to make things work. You have to think about what values are necessary and choose the correct ones.

Using your definition, a month has 31 days. The array therefore goes from 0 to 30 (31 values). 32 is beyond the array bounds, therefore undefined -- a seg fault!

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

realloc()

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

1) Why are you inputting all your stock prices into stock[32] , which is beyond your stock array? It stops at stock[31] .
2) Why are you adding all the stock prices by hand rather than
-- a) in a loop?
-- b) accumulating them during input?
3) What month do you know has 33 days? stock[0] to stock[32] is 33 values.

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

Hey guys I am currently writing a code that will take the user input of a number and convert it to its hexadecimal form with the use of Stack ADT. This is what I have so far and would appreciate any help.

With what? It's helpful to explain in full what the problem is rather than make us guess.

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

Also in assembly.

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

I said put the output outside the loop. howMany() does more than just output.

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

All you need it 1 timer. It can control all 3 timers.

Think through the problem at your desk -- how to control only the RCR first.

Once you have the RCR, add the DTR. What can you do to cause the DTR to stop and start?

Think through the problem away from the computer. Completely understand what to do, then program it.

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

You have a prototype that defines chick as taking two parameters: void chick(int[],int ); Then you call chick with 2 parameters: chick ( Array, n_elements); And you actually defined the function to take 6 parameters: void chick(int Array[],int n_elements ,int compare ,int qMax ,int max,int temp) You need to make everything match.

And please, format your code better. It's very difficult to read.

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

You need to look up how to translate infix (normal a+b) notation into something like reverse polish notation (ab+). RPN makes it easy to calculate an equation. But the translation into RPN is a little harder. Especially when parentheses are part of the equation.

See http://www.google.com/search?q=infix+to+reverse+polish

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

Does a cell have a LostFocus event? If so, replicate hitting ENTER there. This should run as the SUBMIT button is clicked.

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

i didn't write a full code ,
because my compiler Broken

How can your compiler be broken? Did you drop it? Do you need a new one?

if any one can corrected if i have errors

Can't you tell if you have errors? Is that why your compiler is broken?

I really don't know what you are trying to tell us. If you have compiler errors, you must tell us what they are and where they are.

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

It is obvious to me that common decency is far beyond your level.

Common decency? I gave you an answer that will work extremely well. You ignored it.

Can you explain the code from L7Sqr? If so, you should know why didn't it work? If not, that's why it didn't work. Has nothing to do with common decency.

Look at your post:

Thank You, this code works for me but when I try and sub the lastLine I get from my code in place of your s it does not work? Why is this?

Common decency dictates you explain what happened, not force us to use psychic powers to figure out what you did wrong. Show us.

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

1) Store the offset of the current line (for fseek) into an array
2) Read the line of the file
3) Increment COUNTER that counts the line
4) Continue at 1 until EOF
5) Get a random number based on COUNTER
6) fseek() to the line
7) Read the line.

A random line read.