HTML Code:
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;

int main (){
    char filename[50];
    ifstream asd;
    //to close the program if txt does not open
    if (!asd.is_open()){
    char asdasd [50];
    asd >> asdasd;
                      cout << asdasd << " " << " ";
                      asd >> asdasd;
    system ("pause");
    return 0;
I learned this from a tutorial and i mostly understood it but i'm having some problems to understand why it needs <while(asd.good()){> before cout and another <asd >> asdasd;> after cout. Without the while i only have the first word of the txt and without the second <asd >> asdasd> i have compile error. Any clarification d be really appreciated. Thanks