#need help with if statements

28 messages · Page 1 of 1 (latest)

hot edgeBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

tiny imp
#

case package1:
cout << "\nHow many gigabytes of data were used? ";
cin >> gigabytesused;
cout << endl;

        if (gigabytesused < 0)
        {
            cout << "Error.. invalid gigabytes entered. Try again.\n";
        }
        {
        if (gigabytesused > 4)
            cout << "The total amount due is $" << fixed << setprecision(2) << priceA + (gigabytesused - 4) * 10 << endl;
        }
        
        else {
        
            cout << "The total amount due is $" << fixed << setprecision(2) << priceA << endl;
            break;
        }
#

so im sure the brackets are wrong

#

im getting an error in regard to it

woven elm
#

I think you got an extra curly brace under the first if statement

if (gigabytesused < 0)
{
   cout << "Error.. invalid gigabytes entered. Try again.\n";
}
{ // extra opening curly brace here
woven elm
foggy coyote
#

yeah you got to many braces

#

or well in the wrong place

tiny imp
foggy coyote
#

the awnser was already given to you

tiny imp
#

So why type?

#

Lol

#

!close

hot edgeBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity

foggy coyote
tiny imp
#

I’m closing the thread

#

!close

hot edgeBOT
foggy coyote
#

the thread is already closed xD

tiny imp
#

ur annoying bro lol

foggy coyote
#

okay?

hot edgeBOT
#

@tiny imp

Please Do Not Delete Posts!

Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.

tiny imp
#

!solved

hot edgeBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity

foggy coyote
#

kekw 😂

tiny imp
#

ill just talk with a mod

#

np