I am trying to write a program that reads a file named test1.txt of 10 integers and outputs the values to a second file called test2.txt... below is what I have so far, and jus looking for a little guidance.
#include <fstream>
#include <cstdlib>
int read test1.txt
int print test2.txt
Int main()
{
using namespace std;
ifstream in_stream;
ofstream out_stream;
Have you tried to compile this code? The messages issued by the compiler are there to guide you and help identify possible problems with the code. There are several inconsistent uses of names, which the compiler can help you to spot.
Here's a small start as Abstract above. Use code tags please. Read/use the tutorial examples might be useful. http://www.cplusplus.com/doc/tutorial/files/
#include <fstream>
#include <cstdlib>
usingnamespace std;
int main()
{
ifstream in_stream;
ofstream out_stream;
in_stream.open(test1.txt) //<--- no end of statement, quotation marks
out.stream.open(test2.txt) // ditto, ditto
while (test1.txt >10) //<-- 10 is an error
{
cout<< sum to text2.txt<<endl;// <-- #include ???, sum to text2?????
}
In_stream.close() //<-- naming error
Out_stream.close()// <-- naming error
return 0;
} // <--
Line 15: Your cout statement is wrong. Also, you're not writing to the output file.
Line 18-19: Your capitalization is wrong.
You still missing a } to terminate main.
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.