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

Since I can't read your screen from here, maybe you could post what you tried and show us what happened. Can't help without knowing.

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

Oh and my initial value of CreditDebit is floating...there is no value until I give it one...right?? Which means there is an infinite amount of values it can be, until I enter 0 and then the While loop is ended.

Right (mostly). So what are you comparing when it has no value? Or in fact an unknown value. That's bad programming. You should always have a value when you use a variable. Set it to something before the while

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

You are completely missing my point on the variable CreditDebit

#include <stdio.h>
#include <stdlib.h>

int main ()
{
    float bal, CreditDebit;  // here you define the variables
    printf("This is your checkbook balancing utility.\n");
    
    //... more printf's
    
    printf(">>>Please enter your initial balance: ");
    
    scanf("%f", &bal);
    
    // What is the value of CreditDebit here right NOW?  What are you comparing?
    while (CreditDebit != 0) {

Since you have not given CreditDebit a value, what are its possible values?

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

The initial value of CreditDebit is 100

Really? Can you point to the line before the while statement that sets the variable to 100?

This is how my output looks like:

This is your checkbook balancing utility.
You will enter your current balance followed by
checkbook entries. Use + and - to indicate deposits
and withdrawals. Signal the end of processing by
entering a '0'
>>>Please enter your initial balance: 100

Enter deposit (+) or Withdrawl (-): -55
Current balance: 45.00

Enter deposit (+) or Withdrawl (-): -50
***I am sorry, you have bounced this check. $10 will be deducted
Current balance: -15.00

Enter deposit (+) or Withdrawl (-): +10
***I am sorry, you have bounced this check. $10 will be deducted
Current balance: -15.00

This is doing exactly what your code says to do. You add 10 to -15, balance becomes -5. Since the balance is < 0 you deduct 10 making the balance -15. Note the message that says you bounced a check?

Enter deposit (+) or Withdrawl (-): 0
***I am sorry, you have bounced this check. $10 will be deducted
Current balance: -25.00

You entered 0. You processed the 0 as a transaction. You might want to change the place where you ask for the amount, or figure out how to prevent a 0 from processing as a transaction.

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

Well its my first time using functions so Im not really sure what u mean by add it before main because I tried putting the function before main and then it gives absolutely no input... so I undid it and fixed the names below...

Did you notice that the words "function prototypes" are blue and underlined? Do you know what that means when looking at web pages? :icon_rolleyes:

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

Which line of your post answers my question?

Also, why is it people will tell us what it should do but won't show us what it does do? Why not post your output and show us exactly what happens rather than a 'verbal' description?

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

It would be better if you gave names to the functions that make sense. Use a name that describes what the function does. Then the actual code can be followed and we can see what you are trying to do.

Also, at the top, before main() add all the function prototypes. Then you don't have to worry about the order of the functions.

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

What's the value of CreditDebit at the beginning of the while statement?

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

I don't speak alien language. Also, without knowing what went wrong (you didn't explain the problem at all) what can we say?

Maybe you should try reading one field and see if that works. If it does, read one more field. Keep adding until one full line is read.

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

Two possibilities:
1) Change the file so that the missing grades are, say, hyphens:
Jim A
James A+
Smith -
Cathy D
Dazy -
Peter C

2) Read the entire line ( getline() ) and check to see if there is a grade. Then load the name and grade from what you read.

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

Without even looking back I remember someone pointing out that you are destroying your loop counter a, so naturally the outer loop is broken...

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

Depends on what you need help with. Care to tell us what's going wrong?

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

You need to think when you program. Not just make changes and blindly hope nothing else is affected.

You ask for input of a character into variable y . You hit the key labeled 1. What is in y , the number 1 or the character '1'?
What are your case statements asking for?

Think your changes through. Run the program using pen and paper at your desk. When convinced you have it right, hit the computer.

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

You don't need boost for recursion. Just call function traversing the directory while traversing the directory.

Your compiler will probably have filesystem commands to walk through a directory
( findfirst() and findnext() type of functions). Check your compiler documentation.

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

Strings and character arrays cannot be typecast as values. They can only be converted. Look up string to number conversion techniques.

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

Look at kbhit() . With that, getch() , and a timer you can do what you need.

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

Try something. If it doesn't work, tell us what it did wrong and we can help you fix it.

We aren't here to do it for you -- you don't learn that way.

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

Looks like we have another one, guys...

OK, here's the deal. This is not a forum where you request a program and we jump to it and write code for you. If you want that, many of us can be hired to code it for you. At the going rate.

And using the BS that if we write it for you give you a better chance to learn is not going to help. That's such a pathetic idea. It's also called cheating.

Write some code and we'll help you fix it. Free. Otherwise, many of us have access to PayPal.

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

Please read this about fflush() And read this about gets() We also recommend you not use the system() call to clear the screen. It's annoying to the users and it's also not standard.

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

You've got the idea. Read the line. Find ". Start copying until you see another ". Find next ". Copy again until...

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

Do you know structures yet?

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

Andre! No formatting and a full blown answer?!? How could you?

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

for each character? that way the code will be too long, and I for some reason don't see a void or any other user defined function... IT HAS TO BE IN HERE! it's all my homework is about.

So you were expecting us to write your program for you? Not gonna happen. You're taking the class, you know what a void function is, you program what you can. We can help you correct it, but you still have to write it.

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

Based on the code, it doesn't compile. Either explain the real problem or post the correct code.

You can't 'skip' a line. Just read it and ignore what you read.

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

Create two counters. First counts the rolls. Assuming heads, second gets set to 0 on each tail, incremented by 1 on each head.

When second matches the number entered, first counter is number of rolls it took.

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

That's because conio is conio.h. And it's a C header, not C++, so you should remove it. Any functions you need from it are non-standard and should not be used.

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

So what happened when you fixed what I mentioned? And did you look at everything involved in that change?

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

calendarToJulian) is not a variable, it's a function. The ending ) is a big problem.
You call the function but return nothing. Then you call the function wrong a seconf time. Why? Call the function and return the answer. Then use the answer in the output line.

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

Care to elaborate, or do you really want us to search through 200 lines of code not knowing what we're looking for? When asking for help, details are important.

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

i added it before it asks for the number input (because after that it wont let anything output or input) and it outputed: "73076".

so obviously there is something wrong with my infile.open or suffin.

Adding it before the input is worthless. We need to find out what the value is after the input.

If you think there's something wrong with the open, then test for an error after you try to open. Did it work? Find out.

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

orderNumber is a char variable so it's value will be '1', '2', ... '9', not 1, 2, ... 9.

If you need it to become an integer, subtract '0' and it will be correct.

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

So what was read? Don;t just output an error message, output the wrong data too.

The easiest debug tool in C++ is the cout statement. Use it to follow your program as it executes.

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

It would help if you'd describe the problem. Getting stuck is not an explanation.

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

Don't be so vague. Tell us exactly what's happening, not a generic "it doesn't work"

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

Two answers, since your description leaves too much out so it's hard to understand your problem:

1) Since the movie information should go into an array of structures, you don't need any spaces between anything.

2) cout << " "; And please format your code. It's very hard to follow.

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

{ }?

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

That's because you're breaking out of the loop after 16 characters. Instead, when you hit 16
1) reset the character counter
2) output the ENDL

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

Because a letter cannot be put into an integer so the read fails. When you loop back, the letter is still there, so the read fails. When you loop back, the letter is still there, so the read fails. When you loop back, ....

Why do you need an actual number for the menu selection? Read the input as a character. You can still use '1', '2', etc, but 'T' won't kill your program.

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

How would one properly format the block of code with only one cout? I think it has something to do with the semicolons? Any help here?

By using CODE Tags :icon_twisted:

Since semi's end a statement, don't use them:

cout <<"hello"
     <<"how ya doin?"
     <<"goodbye.";
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

What's the formula for a cosecant? Why would they need to add a special function when you can easily use the definition formula?

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

So what's happening now? If you need help, you have to describe in detail what you need help with.

Just curious, why are you using '_' before each structure name?

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

First, your open is fine. Adak, he's using argv to open the data file.
Second, sree_ec is correct.
Third, when you use fgets() to read 2 characters, the array must be of size 3. Remember (or look it up), fgets() always adds an ending \0 and reads length-1 characters.

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

What do you think we are? Coding monkeys?

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

Yes we can. But we are not coding slaves. It's your problem, not ours.

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

Thanks Walt! I should have said it earlier, but I'm using VB.net 1.1

Then why did you post in the VB6 forum?

The code I ended up using is:

Me.strFile = Microsoft.VisualBasic.Left(strFile, strFile.Length - 4)

This will ensure that no matter what the extension is, it will not show in the box!

Really? What if the file name is test.pl or trial.x ? :icon_wink:

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

Help with what? When asking for aid isn't it a good idea to describe the problem? We ain't the psychic programmers...

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

What is x and y?
Are these values already in your class as private variables?
If so, don't pass them as parameters, use them from the class. Your draw() method is part of the class so it has access to all the private values.

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

Use .rfind() to search for the last space. .rfind() starts searching from the end of the string.

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

I wouldn't put it in that pattern. I'd format the code so it can be read by others.