Any ideas what's wrong with this? Although it compiles without a problem, I type in the first 10 digits of pi, press enter, and it won't work. I'm just doing this to get used to importing and exporting files. Thanks.
well i'd be interested in what it does output. From what i'm seeing it would likely output "3"? If that is the case it's because of your use of char and int.
here's an example of something that would likely work better.
1 2 3 4 5 6 7 8 9 10 11 12
#include <iostream>
#include <fstream>
usingnamespace std;
void main(){
longdouble pi;
cin>>pi;
ofstream numbers;
numbers.open ("Values of Pi.txt"); // less of a hassle to open, at least on windows
numbers<<pi;
numbers.close();
}
if you put in
3.141592653
you should get that out.