Hi!
I am trying to make a program, where it opens a text file. If it reads, for instance the "UP and the 2 #s after" in the file, it will print, on the same line (with the data) a result of another #.
for instance:
(command, code, and code2 given in text file)
COMMAND CODE #1 CODE#2 RESULT
UP 10010110 01110101 10110110
what commands can i use to display the result in a certain space (array?), but beforehand initiate by reading the command?
This is what I have so far.
#include <fstream>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
using namespace std;
/*===============================================================*/
void greeting();
void columntitle();
//void not(int i, const int [SIZE] = 7, int op1 [SIZE]);
/*===============================================================*/
int main()
{
const string fileName = "text.txt";
const int SIZE= 7;
char input[SIZE];
char runs;
char commands;
fstream inFile;
char name;
greeting();
columntitle();
//open the file for output
inFile.open(fileName);
while(!inFile.eof())
{
inFile.get(commands);
cout << "" << commands;
}
inFile.close();
return 0;
}
/*==========================================================*/
void greeting()
{
cout << "*********************************************" << endl;
cout << "* *" << endl;
cout << "* Title *" << endl;
cout << "* *" << endl;
cout << "*********************************************" << endl << endl;
}
void columntitle()
{
cout << left << setw(11) << "COMMAND" << setw(14) << "Code #1" << setw(14) << "Code #2" << setw(9) << "Shift" <<"Result" << endl;
cout << setfill('-') << setw(58) << "-" << endl;
}