#include<stdio.h>
#include<math.h>
int main(int argc, char **argv){
// read in the command-line argument
double x,c;
double epsilon = 1e-15; // relative error tolerance
double t ; // estimate of the square root of c
//scanf("%lf",&t);
t=**argv-'0';
printf("%lf ",t);
c=t;
// repeatedly apply Newton update step until desired precision is achieved
while (fabs(t - c/t) > epsilon*t) {
t = (c/t + t)/2.0;
}
// print out the estimate of the square root of c
printf("%lf",t);
return 0;
}
В этой программе я хочу запустить с аргументом командной строки. Как я могу это сделать?аргумент командной строки для запуска программы c
Что 'x' сделать в вашей программе? –
Спасибо всем вам, что ответили мне. Я получил свой ответ. – Moshii