Im sure i have a syntax issue or just not doing something right as i am new to c++.. i am generating an error code in my program ... here is my code
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <string>
#include <string.h>
using namespace std;
int main(int argc, char *argv[])
{
// Opens the Text File in is my "cin" in essence
ifstream in ("C:\\Documents and Settings\\HP_Administrator\\Desktop\\test.txt");
//both arrays in which i will place the text from the text file. "registers" will get the first 8 lines of numbers and memory will get the remaining lines of numbers
int registers[7];
int memory[4000];
int i;
int x;
string s;
string string;
// read registers until eight integers are read
i = 0;
while (getline(in, s)) {
if (stringstream( s ) >> registers[i]) i++;
if (i == 8) break;
}
// read memory until the end of file
i = 0;
while (getline ( in, s )) {
if (stringstream( s ) >> memory[i]) i++;
}
cout << "(:----------REGISTERS----------:)" << endl;
cout << " " << endl;
for (i=0; i<8; i++)
cout << "Registers : " << setfill ('0') << setw (6) << registers[i] << " -:)" << endl;
cout << " " << endl;
cout << "(:-----------MEMORY------------:)" << endl;
cout << " " << endl;
for(i=0; i<14; i++)
cout << "Memory Dump : " << setfill ('0') << setw (6) << memory[i] << " -:)" << endl;
cout << " " << endl;
cout << "(:-----------------------------:)" << endl;
if (memory[i].substr(0,4)=="0000")
(
cout << "See Groups 3 & 4 " << endl;
)
in.close();
the error generated is as follows:
in function 'int main(int, char**):'
'substr' has not been declared
request for member of non aggregated type before '(' token
any help is greatly appreciated thank you very much