Hi everyone, I am new here and also new to programming.
I am given a list of codes in the type of <iostream>,
but the codes that I've learnt is in the type of <stdio.h>,
is there any reference of comparism between these two types so that I can convert it to the one I want?
Below is the code,
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
When you say "convert" do you mean "translate" (e.g. printf("Hello, World!\n") -> std::cout <<"Hello, World!"<<std::endl) or convert objects (e.g. FILE -> std::fstream)?
Erm, basically I wanna get the code to be able to use in C.
By [convert], I am trying to get the code above change to the one I am learning, e.g. <iostream> header should be <stdio.h> in what I learn,
how bout the other <fstream> header, ifstream variable type, I have got no idea at all.
readMatch is declared as an ifstream instance, so readMatch>>ID>>WORD //Important: >> not <<
will read ID and WORD from the the associated file.
If this occurs without problem the expression will evalueate to TRUE, and the while will cause it to read the nect pair.
If there is a problem reading (including reaching end of file) this will set the error flags of readmatch, it will evaluate to false and exit the while loop.