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.
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;
}