Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок0
define variable
Is there anyway to define variables at only one line that doesnt alter its value at all other line for exp i want to find quotient of a diving b so i have to double a, b; but at other line to find the remainder of a diving b it must be integer so how to define a and b as integer at only that line
1 ответ
+ 1
void doAllThat(double a, double b)
{
cout << a / b << endl;
cout << int(a) % int(b) << endl;
}
Forgive me, if that's not what you're asking about, but I've had a hard time understanding your question.
Also it's better to use round(), floor() or ceil() instead of int(). Like this: cout << floor(a) % floor(b) << endl;