N Nguyên Lê New member Sep 21, 2021 #1 What will be the output of the following C++ code? Code: #include <stdio.h> #include <stdlib.h> int main () { char s[] = "365.24 29.53"; char* p; double d1, d2; d1 = strtod (s, &p); d2 = strtod (p, NULL); printf ("%.2f\n", d1/d2); return 0; } A. 12 B. 12.37 C. 13 D. 15
What will be the output of the following C++ code? Code: #include <stdio.h> #include <stdlib.h> int main () { char s[] = "365.24 29.53"; char* p; double d1, d2; d1 = strtod (s, &p); d2 = strtod (p, NULL); printf ("%.2f\n", d1/d2); return 0; } A. 12 B. 12.37 C. 13 D. 15
N Nguyên Lê New member Sep 21, 2021 #2 Answer: b Explanation: In this program, We are calculating the double value by using the floating point number and we are using the function strtod. Output: Code: $ g++ cinc.cpp $ a.out Upvote 0 Downvote
Answer: b Explanation: In this program, We are calculating the double value by using the floating point number and we are using the function strtod. Output: Code: $ g++ cinc.cpp $ a.out