Ask your own question, for FREE!
Computer Science 19 Online
Ballery1:

i tried copying an example from the textbook straight onto my IDE and i'm getting a bunch of errors...even though i've copied everything exactly what is on the textbook :/ halp

Ballery1:

1 attachment
Ballery1:

@Ultrilliam

Ballery1:

i moved the open curly bracket to line 6 and i'm still getting the same bucket of errors in the end... :/ why?

Ultrilliam:

Please copy+paste the code in codeblocks like here: ``` //code ``` Like this: \``` Code here \```

Ballery1:

``` //This program calculates the user's pay #include <iostream> using namespace std; int main() [ double hours, rate, pay; //Get the number of hours worked. cout <<"How many hours did you work? "; cin >> hours; //Get the hourly pay rate. cout << "How much do you get paid per hour? "; cin >>rate; //Calcualte the pay. pay = hours * rate; //Display the pay. cout << "You have earned $" << pay << end1; return 0; ] ```

Ultrilliam:

ok, wait a minute

Ballery1:

ok sir

Ultrilliam:

``` //This program calculates the user's pay #include <iostream> using namespace std; int main() { double hours, rate, pay; //Get the number of hours worked. cout <<"How many hours did you work? "; cin >> hours; //Get the hourly pay rate. cout << "How much do you get paid per hour? "; cin >>rate; //Calcualte the pay. pay = hours * rate; //Display the pay. cout << "You have earned $" << pay << end1; return 0; } ```

Ultrilliam:

Why were they square brackets

Ballery1:

where? :O

Ultrilliam:

I changed it, the main function was square brackets not curly brackets, lol

Ballery1:

oof omg o///o

Ballery1:

sorry, i didn't look close enough to realize those were square brackets. Let me go run this thing real quick ... and thanks for catching my mistake pal :)

Ultrilliam:

Np, lol

Ballery1:

yayy!! it works :)))))

Ballery1:

actually nvm... another error o///o

Ballery1:

1 attachment
Ballery1:

what have i done wrong now ? :/

Ultrilliam:

``` //This program calculates the user's pay #include <iostream> using namespace std; int main() { double hours, rate, pay; //Get the number of hours worked. cout <<"How many hours did you work? "; cin >> hours; //Get the hourly pay rate. cout << "How much do you get paid per hour? "; cin >>rate; //Calcualte the pay. pay = hours * rate; //Display the pay. cout << "You have earned $" << pay << endl; return 0; } ```

Ultrilliam:

It's endl, not end1

Ballery1:

i knew that but i looked close in my textbook and it kinda looks like 1 tho :/ k let me change that to endl....aka end line

Ballery1:

it works!!! yay!!

Ballery1:

ultri, do you know of any website that gives small programming tasks to students to help them get started ???

Ballery1:

i don't have any programming experience and i'm absolutely itching to have real experince with IDE and code making... im sick of taking notes blindly

Ultrilliam:

Uhhh, I THINK khan academy does, but I don't recall for sure

Ballery1:

ok let me try them and i'll let chew you. Thanks buddy. thanks a lot for your help pal. :) <3

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!