Sorry for being a pain but I am google eyed from searching the net with no success..
Basically this is my program, working fine.
Code:#include <stdio.h> int main() { int Number[14]={1,1,1,1,1,1,1,1,1,1,1,1,1,1}; int i, Calc; /*Here some fancy calculation happens to the integer array digits which results in a single integer value Calc */ printf("%d", Calc); return 0; }
Now this all works fine, exactly as expected but what I want to do is promt the user to input the 14 digit number and fill the integer aray using their input.
What I have tried so far:
Basically scan for 14 integers and store them into each array segment.Code:scan f("%d %d %d %d.....%d", &Number[0], &Number[1], &Number[2]....) //etc
The code compiles but the program hangs after inputting any numbers.
I have also tried:
Basically inputting a string and using atoi to convert to integer. This however produces the wrong value of Calc digit, and printing the value of Number_Out shows that atoi is not working as expected..Code:char Number_In[15]; int Number_Out[14]; int i; for (i=0;i<14;i++) { scanf("%s",Number_In); Number_Out[i] = atoi(Number_In[i]); }
Surely there must be a simple way to do this that I have missed?
Any help greatly receieved,
Cheers.
D.


)