Hi. I just started with Object Oriented programming in C++ and i got a book from the library which has some exercises but sadly no solutions for them,... and i got this problem... Well, i have to put in the length of sides of a square (they are required to be entered as integers). But then i have to write a method to extend their length for a certain %, but here the tricky part that for that to show up correctly i would have to use double or somehow transform from int to double... And i would like to ask how can i change the type? -as i have been breaking my head for this latelly...
double x, y;
void setxy(int a, int b) //Still uses int
x=a; //Will work fine (implicit type conversion here)
void change(int proc)
x += x * (proc / 100.0); //Readability and correct division
y += y * (proc / 100.0); //(floating point instead of integer one)