### I need help so bad

done
Last edited on
Oh don't worry, I will help. (Of course not to the point of typing this) But dear god... and you JUST moved into the class?

Edit: As listed bellow, that's a good source. Tell us if you need help on that material, I just got you started on the basic stuff below below, so you don't freak out.
Last edited on
I'm sorry to say, but nobody will simply write this for you. I sympathize for your situation but you will need to write some code and show us what you have in order to really get some help. Otherwise, this site offers a lot of great tutorials to get started and honestly this is simple stuff that even someone with 1-2 days experience with C++ could get done in a few hours. Just gotta get some reading done.

http://www.cplusplus.com/doc/tutorial/
Search up for loops, "%" in c++, std, and "stop" you could find fairly easily.
I'll give you help on most of this just to get you going.

 ``1234`` `````` cout<<"Input n"; //It's how they got the "n" thing going cin>>n; ``````

So now you know how to get the variable input thing.
 ``1234`` `````` n%2 =0 // 0 is what should happen if it's positive here (n+1)%2 =0 // and odd here ``````

here you now know how to c heck for positive, negative ( x%y x=number being checked if it's divisible by y, y is the one that's checking)

 ``1234`` `````` while(x==y) // This loop would continue while x equals y and stop once it doesn't. while (x!=y) // This loop would continue while x is not equal to y, most of you problems would use this ``````

Last edited on
I changed my major and joined this class but its too difficult I dont know that much stuff.
 ``12345678`` ``````#include using namespace std; { return 0; } ``````

thats all I know. This assignment due on tomorrow night. i know no one will do my homework but I need help. What stuff do I need to do this homework.
Your program will always have a main() function, that's where it starts.
You can then write as many additional functions as you want.

 ``12345`` ``````int main() // this function returns an int (integer) { return 0; // zero is an integer // function ends here, after the return statement }``````

To use functions provided by C++, like for printing stuff or getting input from the keyboard, you will #include parts of the C++ library. For now, the iostream file is needed.

 ``12345678910111213141516`` ``````#include // you add a // using namespace std; // to prevent having to write `std::' in front of C++'s library elements int main() { // function body, inside the curly braces int n; // this variable holds the number the user gives std::cout << "Input your number: "; std::cin >> n; std::cout << "Your number is " << n << ".\n"; // call functions here... return 0; }``````

You have to learn about control structures: if conditional, and for, while and do-while loops, here:
http://cplusplus.com/doc/tutorial/control/
Then the idiotic "count and print" parts should become easy.

Let's do the square, cube and square root parts.
 ``123456789101112131415161718192021222324252627282930313233343536373839`` ``````#include #include // needed for the square root C++ library function, sqrt() int square(int number) // function is named square // takes an integer as a parameter // returns an integer, which will be the square of "number" { return number * number; } int cube(int number) { return number * square(number); // we have to use square() } double square_root(int number) // this function returns a floating point number, not an integer { return std::sqrt(number); } int main() { // function body, inside the curly braces int n; // this variable holds the number the user gives std::cout << "Input your number: "; std::cin >> n; std::cout << "Your number is " << n << ".\n"; // notice how the results from the functions are displayed // notice how the functions are being fed our n variable std::cout << "Square of " << n << " is " << square(n) << '\n'; std::cout << "Cube of " << n << " is " << cube(n) << '\n'; std::cout << "Square root of " << n << " is " << square_root(n) << '\n'; return 0; }``````

Good luck with the rest.

 ``12`` ``````int ch; cin>>ch; //getting input from user! ``````