0
Does anybody know why I get an error? Could you help me solve it please
4 Réponses
+ 3
1) The header <conio.h> is not only outdated, but also not standard C++, and therefore unlikely to be accessible on most compilers. Same goes for getch(), since it comes from the header.
2) Spelling error on line 44, it should be printf.
3) Sometimes you try to use undefined variables, for example "xb1" on line 50.
4) Wrong operator in scanf on line 57, it should be & instead of %.
4) You keep trying to use the syntax
y( some_variable )
which is not a valid operation. What exactly are you trying to accomplish with it?
+ 2
Okay, so I guess you are trying to plug the variables into the 'y' function from your task then. The problem is that the 'y' from your code is just a simple variable, and the compiler doesn't know anything about the function itself, you need to define that. I would create a distinct function (you can still call it y) to calculate the result, e.g.
double y( const double y )
{
return ( 147 * pow( e, t ) + ... );
}
To be able to use 'e' within that function, you would have to move it into the global scope though.
Also, you repeat the same error for y_1 on line 47. If that is another function, you would again have to define it first.
0
Elaborar un código en C para compilar un programa que realice el cálculo de la raíz de la siguiente
función.
𝑦(𝑡) = 147 𝑒
𝑡 +
50
𝑡
(𝑒
𝑡 − 1) − 208
Esta función modela el crecimiento de la población de una ciudad donde incluye las defunciones y
la inmigración anual.
El programa debe calcular la raíz de la función usando los métodos de Bisección, Newton y
Secante.
La tolerancia al error porcentual debe ser menor a 0.001
Debe guiarse con el programa de la imagen que se anexa y debe hacer como mínimo lo mismo que
este.
Write a code in C to compile a program that performs the calculation of the root of the following
function.
𝑦 (𝑡) = 147 𝑒
𝑡 +
fifty
𝑡
(𝑒
𝑡 - 1) - 208
This function models the population growth of a city where it includes deaths and
annual immigration.
The program must calculate the root of the function using the methods of Bisection, Newton and
Drying.
Percentage error tolerance must be less than 0.001
It should be guided by the program of the attached image and should do at leas
0
That's what they asked me