Begginer need help at homework

Hello, this week we just started at school learning basic c++ operations, the theacher is an older man with no sense for people so he has a hard time teaching us. He gave us some homework and i dont know where to start because he just learned us how to write some Hello World code and next day is giving us some mathematical tasks that i dont understand so i was hoping someone can help me writing the code so i can see at least how it looks like.

Task 1.
Create a program that neatly prints pairs of values ​​(x and y) for points in the direction y = 3x-2. The independent variable should be changed from xp (x initial) to xk (x final) in k steps. Data is entered by the user:
xp =
xk =
k =
Printing value pairs should go to a table, where x is printed in a 10-character space, with 3 decimal places, and y in a 12-character space with 4 decimal places.
Which type should be chosen for the variables xp, xk and k?
Be sure to print ruler x10 and ruler x1 at the beginning to check the format.
Separate the columns of the table with a vertical line.

Task2.
Create a program that neatly prints the following 4 functions to the value table:
x
x ^ 2
x ^ 3
x ^ 4
For all values ​​of the independent variable x that varies from the initial xp to the final xk value incrementally increasing by the offset dx (delta_x).
User enters:
xp =
xk =
dx =
Values ​​are printed in one line for one value of x (a new line is printed for each new value of x).
x should be printed in a space of width 8, with 3 decimal places,
x ^ 2 should be printed in a space of width 9, with 4 decimal places,
x ^ 3 should be printed in a space of width 10, with 5 decimal places,
x ^ 4 should be printed in a space of width 11, with 6 decimal places.
Separate the columns of the table with a vertical line.

I hope you can understand the english, because the tasks were put into a google translate
Last edited on
he just learned us
the Spanky is strong in this!

start up doing some of the little stuff.
can you read 3 values from the user?
do you know how to write a for loop?

try to do just the first task as far as you can get, asking the user for input, etc.
Post what you come up with, using your notes and materials from the class.
once you have gotten started, if you get stuck, ask here exactly what you do not know how to do or show some code you can't get to work and explain what it does wrong.
Last edited on
but is it that you don't know how to code the c++ stuff - or don't understand the maths? If the question 1) was to produce a graph on paper for the equation y = 3x -2 from x value xp to x value xk could you do it?
Topic archived. No new replies allowed.