|
-
March 26th, 2010, 10:44 AM
#1
Help understanding
hey guys this is a homework question, so to be straight foward I am NOT looking for ya'll to solve the problem for me. that being said I am writing my second c++ program. I have built a solution and I have 2 errors and 2 warnings. here are the parameters of the assignment
Write a program using the fstream function that will take information from a text file, manipulate the information and output it into a second text file.
here is the source code
//Kraig Holdren
//CS106
//Ken Washington
// March 25, 2010
//This program will take information from the text file "inData.txt"
//manipulate the data and output the results into a seperate text file.
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
//stream variables
ifstream inFile;
ofstream outFile;
//variables to be calculated
int Sum;
int Product;
char A;
//Tells the program what file to open
inFile.open("inData.txt") ;
//program will create this file for the output
outFile.open("outData.txt") ;
inFile >> A;
outFile << "The character from the file is K" << endl;
inFile >> 10, 10;
Sum = 10 + 10; endl;
outFile << "The Sum of 10 + 10 =" << Sum << endl;
inFile >> 10, 10;
Product = 10 * 10; endl;
outFile << "The Product of 10 * 10 =" << Product << endl;
inFile.close();
outFile.close();
return 0;
}
the errors I am getting are
LINE 32 AND 36: error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'int' (or there is no acceptable conversion)
and 2 warnings
LINE 33, 37: warning C4551: function call missing argument list
Like I said in the begining I dont want you guys to do the assignment for me, I am just thick headed and need help understanding why I have come to these problems
Thanks
Kraig
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|