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

Look up Comparison operators in your book. It's best to check your book when someone makes a comment -- however cryptic -- and not just post back "I don't know".

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

Also, my entire program is pretty big, so I didn't want to post the whole thing - I have the rest of it formatted properly (I think).

That's OK, as long as what you post has the problem and we can read it. Please reformat the code. Can you actually read what you posted?

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

Do not start another thread on the same subject. Continue with the original thread so we can see what came before. We do not need to tell you the same things over and over which is what a new thread will do.

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

Reread my post. I gave you the answer.

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

Change the input statement into calls to rand() . Be sure you look up how to use it correctly.

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

yeah, that too...

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

Please ignore yila's code. It is full of problems.

yila, please refrain from posting (supposedly) working code for people. They learn nothing so you are hurting more than helping. Especially when you use bad coding practices.

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

Why?

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

Books and Tutorials.

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

main()
{
    //declares an array of strings    
    string item_name[number_of_items];
    
    cout << "How many items does the customer have? \n";
    cin >> number_of_items;

When you use number_of_items, what value does it have? How large is the array?

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

You need to think about what you are trying to accomplish, what variables and/or values you need in the function, and change the parameters accordingly.

FYI, posting on a forum is not the time to turn the brain off and get us to fix it for you. It's your project. We will point you in a direction we think is appropriate but you ultimately need to solve the problem.

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

Yes. Start VC. Choose the project type. Write the code.

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

Do you see a problem with if (minute = TimeToAlarm[g]) ? Is the comparison correct?

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

Also , I it seems too common that people [that reply] always state the problem and never give solutions to it , frustrating ...
[solution: state the solution to problems you replay to in your posts before you click "post"]

It also seems too common that people [that ask Q's] rarely state the real problem and never give enough details to understand it , frustrating ...
[solution: state the problems clearly with details and don't post 400 lines of code when 20 would do. And click PREVIEW so you can verify your problem is clearly stated before you click "SUBMIT"]

Try reading posts to HELP sometime.

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

Also, you did not start the program by defining a console program.

_tmain() and stdafx.h are not standard and supplied by VC because of the type of program you told it to create.

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

Only the ones you write.

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

asteroidproject\asteroidmain.cpp(9) : error C2664: 'Asteroid::Asteroid(const Asteroid &)' : cannot convert parameter 1 from 'int' to 'const Asteroid &'
1> Reason: cannot convert from 'int' to 'const Asteroid'
1> No constructor could take the source type, or constructor overload resolution was ambiguous

If you define a parameter as const Asteroid &, you can't pass it an int. Check your parameters.

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

Resurrecting an old thread, eh? :icon_wink:

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

Why? When you see your first " stop looking for ; and look for a " instead. When you find the ", continue looking for ;.

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

I know it may not be hard but perhaps I should have mentioned I'm a beginner user.

I actually appreciated that you didn't say it. It's excruciatingly obvious if you post a simple program like this on a help board. I wish more people would keep mum about their noob'ility. :icon_wink:

Anyway, I realize it involves slashing rows by half but I could not come up with a suitable solution to solve his problem :S

As jephthah said, I just gave it to you... :icon_rolleyes:

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

How can it be hard?

Loop I from 1 to N
    Loop J from 1 to I
        Print *
    Print \n
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Well, what could possibly stop the variable from being loaded?
Error on read?
Can't get to the read?
Error opening the file?

Did you check for any of these errors? I see no error checking at all.

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

As this is the 4th (or is it 5th) resurrection of the same lame question, this thread is going away....

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

Display your input to the screen when you read it. That way you know if it's being read. If it doesn't display you've found the problem.

you can certainly sprinkle cout statements all over the place to tell you what is happening as the code executes. Then remove them as you fix problems they point out.

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

Are you asking us to write it for you? Or are you asking us to help you correct your code that doesn't work?

If the first, forget it. We are not a coding service.
If the second, great. But we aren't psychic and can't tell what you tried that didn't work unless you show us. Be sure to use CODE tags when you do show us.

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

Bingo!!!!

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

I don't know? Why can't you? When you tried it did you get the correct answer?

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

I am going to fix my code to model this or something of the sort but what if i have multiple records with id numbers such as that above could this code be implemented in such a way to search the file

Then you need to understand not only what he did, but what you need. Then think about how you can accomplish your search.

Direct answer, of course it can. It's code. It can be modified to do anything.

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

The thread-revivers are usually either spammers or, more often, a newbie who is trying to help and isn't noticing the dates. I'm guilty of several of those myself, I think. They tend to get pounded a bit harshly in my view. First post, trying to help, and they get told that they're an idiot for reviving an old thread.

Maybe so, but if there are 1000 pages of threads, and you are looking at page #500, you'd think the post is not current. Especially when the 1st page has maybe 2 days of posts.

Frankly I think reviving an old thread can be useful sometimes. Maybe you have something to add that wasn't mentioned and the thread provides a good segway into it.

Yes, but that 5% that are useful if someone cares later are over shadowed by the other 95% that are:
1) "I have this problem, too"
2) "Here's some really bad code that doesn't really answer the question"
3) "Nice post"
etc.

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

Thank you for that but if i wanted to search the file for other records can this code be modified to achieve that

Why? Are you planning on using his code as your code or were you planning on fixing your own code after understanding his?

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

Now use that ides to do your program. It only takes a few changes.

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

Two things:
1) Title - Time interval....i need an answer pls.. -- i need an answer pls??? Why would you post a question and not expect an answer? Just describe the problem, don't add a useless order to it.
2) Always reread your post to make sure it is understandable. As written it makes no sense. Do you mean:

1) When you log in you have 30 minutes
a) before you can log out (stuck to 30 minutes logged in)
b) then you will be automatically logged out.

2) You cannot log back in for
a) 8 hours.
b) until the next day.

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

Add it to the compile command.

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

See if the concepts here can help you:

number1 and number2 are input.

i = number1;
val = 100;
while (i > number2)
{
    val = val - i;
    i = i - 2;
}

What does this code do?

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

Try

cout << (char) tolower ( Name[2] ) << endl;
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Look up the function strftime(). You can create any string you want with it.

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

Yes it does. But when I opened the thread at around 3:12 the other posts weren't there. Then I got called away and finished my post at 3:37.

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

Why not just hit Ctrl-C. It'll stop the program too. :icon_wink:

You need to test the return from cin and look for EOF

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

And another thing: Apart from the fact that you're using "cout" to display your value, there's nothing C++ about this program. If it isn't homework, might I suggest the following:

#include <iostream>
#include <bitset>

int main()
{
    unsigned int num = 24;
    std::bitset<32> bs(num); // 32 bits integer
    std::cout << bs;
}

output:
000..etc..11000

But that does not teach the concept of bit manipulation which is presumedly the purpose of this task...

Fbody commented: this is true... +1
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

How to add, subtract, multiply and divide 2 different numbers from 2 different form. Pls help me. The code i think is way too simple example: (Result.text = result) (Text1.text = number from form2)(Text2,text = Number from form3). the code i think is like this and this one is not working:

Public Sub Command1_Clicked()
Result.text = Val(Text1.Text) + Val(Text2.text)
End Sub

Pls help me... i cant sleep because of this problem.

Try

Public Sub Command1_Clicked()
Result.text = Val(Form2.Text1.Text) + Val(Form3.Text2.text)
End Sub

Now go to bed!

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

@micjan : Congrats you got the code !!! I certainly wish the two smart people above get you everything you want in your life

Especially since both of them answered with terrible non-standard code, which makes the code dangerous to people's understanding of good code practices. Please ignore the code given.

Salem commented: They were horrid excuses for programs weren't they :) +19
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

bin[0] is one value.
You need to print all the values, like in a for loop.

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

Because he's a weenie and thinks people want to use Java.

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

It sure would be nice if links were posted :icon_rolleyes:

Compilers
Code::Blocks
MSVC++ Express
Open Watcom C++/Fortran
Bloodshed DevC
Turbo C++ Explorer 2006

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

I've figured out how this Cleverbot works :icon_twisted:

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

Ahhh, I deciphered the question, which is
Keeping the textbox visible, can the contents of the box be invisible...

Yes, set the background and foreground color of the textbox the the same value.

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

Using two different styles for curly braces is not being consistent. Using 4 SPACEs for indents then 8 SPACEs is also being inconsistent.

I recommend

if (xxx)
{
    code;
    code;
}

to immediately see any mismatched braces -- which is your problem.

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

The only thing I can't get to work is the countValue function.

...
//count the number of occurrences of each number in the linked list
Node* countValue(Node *pHead) //<------HERE'S THE PROBLEM
{
...

So you don't think actually explaining what the problem is could be important? Pointing to a line is enough?

Please reconsider...

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

Here you go:
Why scanf() is bad

If you haven't been taught anything but scanf() , you must live with its idiosyncrasies until you are taught something better. Bulletproofing input is not trivial and you don't seem to be ready for it's complexities. Give it a few weeks.

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

Any ideas?

Yeah I do, but you won't listen.