this is what the assignment says :
Create a text file with a letter on the first line, and two double-digit numbers on the second line. Write a program using fstream that reads in your text file, creates variables to manipulate that input and outputs the following results to a different text file:
"The ASCII value of your character: " __ " is " ____"
(you will need to cast from a char to an int)
"The sum of " ___ " and " _____ " = " _____ "
(add the two numbers, display both the numbers and final result)
"The product of " ___ " and " _____ " = " _____"
(multiply the two numbers, display both the numbers and final result)
here is what i have
a data text file in c:\ called data.txt
inside the file i have the letter "h"
on the 1st line
on the 2nd line is 54 & 66
it reads like this
----------------------------------------------------------------------------------------------------------
h
54 66
----------------------------------------------------------------------------------------------------------
here is the code i have so far
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
int main ()
{
//variables declared for fstream
ifstream indata;
ofstream outdata;
//files to open and to close
indata.open("c:\\data.txt");
outdata.open("c:\\results.txt");
char line1;
int line2a, line2b;
indata >> data.txt = line
cout << " The ASCII value of your character: " __ " is " ____" << endl;
return 0;
}
and now im stuck ...
i do believe i have the right declaration , i dont know how to make the this run any more than what i got
can any one show me the code im suppose to be using and why ???