Jump to content

Is it possible to post my code here and ask for help?

Mr. Brovahkiin

I have C++ homework that I can't figure out. Would it be possible to post the code and have someone tell me what's wrong?

Link to comment
Share on other sites

Link to post
Share on other sites

Do it. Id like to learn more about code so if someone answers it then id be learning aswell. You could also try asking the WOW support team, I hear they are quite good at doing homework.

Link to comment
Share on other sites

Link to post
Share on other sites

Oh well here goes nothing

#include

using namespace std;

int main ( )

{

double grade;

cout << "Please enter grade " << endl;

cin >> grade;

if (grade <= 100 || grade >= 93)

cout << "Percentage: " << grade << " Grade: A "<< "Points: 4.00" << endl;

else if (grade <=92 || grade >=90)

cout << "Percentage: " << grade << " Grade: A- "<< "Points: 3.65" << endl;

else if (grade <=89 || grade >=87)

cout << "Percentage: " << grade << " Grade: B+ "<< "Points: 3.35" << endl;

else if (grade <=86 || grade >=83)

cout << "Percentage: " << grade << " Grade: B"<< "Points: 3.00" << endl;

else if (grade <=82 || grade >=80)

cout << "Percentage: " << grade << " Grade: B- "<< "Points: 2.65" << endl;

else if (grade <=79 || grade >=77)

cout << "Percentage: " << grade << " Grade: C+ "<< "Points: 2.35" << endl;

else if (grade <=76 || grade >=73)

cout << "Percentage: " << grade << " Grade: C "<< "Points: 2.00" << endl;

else if (grade <=72 || grade >=70)

cout << "Percentage: " << grade << " Grade: C- "<< "Points: 1.65" << endl;

else if (grade <=69 || grade >=67)

cout << "Percentage: " << grade << " Grade: D+ "<< "Points: 1.35" << endl;

else if (grade <=66 || grade >=63)

cout << "Percentage: " << grade << " Grade: D "<< "Points: 1.00" << endl;

else if (grade <=62 || grade >=60)

cout << "Percentage: " << grade << " Grade: D- "<< "Points: 0.65" << endl;

else if (grade <=59)

cout << "Percentage: " << grade << " Grade: FAIL!!! "<< "Points: 0.00" << endl;

else

cout << "You dun goofed. Put a valid input in";

system("pause");

return 0;

}

Every time I enter anything I just get the first response and it never goes past it. I'm sure it's something painfully obvious but it's not clicking. Try not to be too rough I'm still learning

Link to comment
Share on other sites

Link to post
Share on other sites

Do it. Id like to learn more about code so if someone answers it then id be learning aswell. You could also try asking the WOW support team, I hear they are quite good at doing homework.
WOW support team?
Link to comment
Share on other sites

Link to post
Share on other sites

I had a quick look, I know nothing of C++ really but I thought if I saw something that looked outright stupid I might be of some help.

Then I spotted this: "You dun goofed. Put a valid input in" Lol awesome. What does this code actually do if I may ask?

Link to comment
Share on other sites

Link to post
Share on other sites

When you input a grade (any number between 0 and 100) it gives you roughly what GPA it is and what letter grade it gets. It also takes whatever you input and puts it in there as well.

Link to comment
Share on other sites

Link to post
Share on other sites

Do it. Id like to learn more about code so if someone answers it then id be learning aswell. You could also try asking the WOW support team, I hear they are quite good at doing homework.
LOL I didn't think you actually meant that WOW. That's freaking awesome haha
Link to comment
Share on other sites

Link to post
Share on other sites

you're using or instead of and.

it goes to the first if statement, and any number is less than 100 or greater than 93, so it does the first if and exits the if structure.

Will work for electronic components and parts


Reviews: Meelec CC51P - Monoprice 8323 - Koss Porta Pros  - Shure SRH-440 - Shure SRH-550DJShure SRH-840 - Hifiman He-500 - iBasso D4 - o2 Amplifier  -  SkeletonDac

Link to comment
Share on other sites

Link to post
Share on other sites

you're using or instead of and.

it goes to the first if statement, and any number is less than 100 or greater than 93, so it does the first if and exits the if structure.

Like I said. PAINFULLY obvious. Thank you so much
Link to comment
Share on other sites

Link to post
Share on other sites

As you can see, it was possible. You had the ability to do it, and you proved it by doing it. Good job.

I have a 2019 macbook pro with 64gb of ram and my gaming pc has been in the closet since 2018

Link to comment
Share on other sites

Link to post
Share on other sites

As you can see, it was possible. You had the ability to do it, and you proved it by doing it. Good job.
Yeah I don't know why I was using or when if I had actually stopped and read the statement out loud I would have realized it was wrong. Now I get to switch it to a switch function. Oh joy lol
Link to comment
Share on other sites

Link to post
Share on other sites

Not very elegant but...

	switch (grade) {
	  case 100:
	  case 99:
	  case 98:
	  case 97:
	  case 96:
	  case 95:
	  case 94:
	  case 93:
	    cout << "Percentage: " << grade << " Grade: A "<< "Points: 4.00" << endl;
	    break;
	  case 92:
	  case 91:
	  case 90:
	    cout << "Percentage: " << grade << " Grade: A- "<< "Points: 3.65" << endl;
	    break;
	  default:
	    cout << "You dun goofed. Put a valid input in";
	}
Link to comment
Share on other sites

Link to post
Share on other sites

As you can see, it was possible. You had the ability to do it, and you proved it by doing it. Good job.
I was actually reffering to the title of your post "is it possible to post my code here and ask for help?". So yes, it is possible, proof by the creation of this thread.

I have a 2019 macbook pro with 64gb of ram and my gaming pc has been in the closet since 2018

Link to comment
Share on other sites

Link to post
Share on other sites

Not very elegant but...

switch (grade) {

case 100:

case 99:

case 98:

case 97:

case 96:

case 95:

case 94:

case 93:

cout << "Percentage: " << grade << " Grade: A "<< "Points: 4.00" << endl;

break;

case 92:

case 91:

case 90:

cout << "Percentage: " << grade << " Grade: A- "<< "Points: 3.65" << endl;

break;

default:

cout << "You dun goofed. Put a valid input in";

}

Is there any way to set a range similar to the code I posted? I'm sure my teacher would kill me if I gave her that haha
Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×