Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in finding the last required value #314

Open
muhammad4373 opened this issue Aug 24, 2023 · 1 comment
Open

Error in finding the last required value #314

muhammad4373 opened this issue Aug 24, 2023 · 1 comment

Comments

@muhammad4373
Copy link

muhammad4373 commented Aug 24, 2023

Here i cannot find the last value it gives me the $0.00 value everytime if anyone knows please help me out.
and at the terminal window where we run our code it is showing me this
Bill before tax and tip:
this is wrong i cannot run the code like this it should be just like this
$: right???

now after restarting when i write make half and ./ half both times it is saying that half is a directory and ./half is a directory :(

This is the code i write for my problem set 1 half.

#include <cs50.h>
#include <stdio.h>

int main (void)
{
int bill = get_int("bill ?");
int tax = get_int("tax ?");
int tip = get_int("tip ?");

printf(" bill is %i. tax is %i. tip is %i. , bill , tax, tip");

}

@nighanxiety
Copy link

now after restarting when i write make half and ./ half both times it is saying that half is a directory and ./half is a directory :(
Everytime you restart your CodeSpace, the terminal goes back to the home directory. You need to use the "cd" command to go back into the directory where your program is. In this case, use cd half

printf(" bill is %i. tax is %i. tip is %i. , bill , tax, tip");

You aren't passing any values to the format parameters here, and it appears that you are not calling the half() function at all.
I believe the provided distribution code included the line:
printf("You will owe $%.2f each!\n", half(bill_amount, tax_percent, tip_percent)); already.

You need to implement the half() function below main so that it returns the correct value to the printf statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants