Please help! How do i write a code in c++ <stdio.h> to read two different inputs from a txt file and store them into arrays? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please help! How do i write a code in c++ <stdio.h> to read two different inputs from a txt file and store them into arrays?

i need to read two different inputs from a txt file, one is for the power of the root and the other is the number under the root so i can calculate the sqrt using a method of approximation.

24th Apr 2018, 6:36 PM
Ahmed Alknany
1 Answer
0
#include<stdio.h> #include<math.h> using namespace std; int main() { int n,i,s,a[2]; printf("enter a no."); scanf("%d",n); s=sqrt(n); a[0]=n; a[1]=s; for(i=0;i<2;i++) { printf("%d ",a[i]); } return 0; }
24th Apr 2018, 6:49 PM
ARIF ANSARI
ARIF ANSARI - avatar