Hey im a real noob at c++ and im trying to understand creating rooms setting a default and using a .txt file for room details. but i dont understand it. Im looking at some code from my lecturer and i dont understand were the wiz0-2.save comes from can some tell me. or have another tuturiol to help me understand this. Thanks.

//main.cpp
#include "Wiz.h"
#include <iostream>
using namespace std;
intmain()
{
//Create wizards with specific data
Wizard wiz0;//("Gandalf", 25, 100, 10);
Wizard wiz1;//("Loki", 50, 150, 12);
Wizard wiz2;//("Magius", 10, 75, 6);
//Output the wizards before they are loaded
cout<< "BEFORE LOADING..." << endl;
wiz0.print();
wiz1.print();
wiz2.print();
//Create a stream which will transfer the data from
//the specified file "wizdata.txt" to our program
ifstreaminFile("wizdata.txt");
//If the file opened correctly then call load methods
if(inFile)
{
wiz0.load(inFile);
wiz1.load(inFile);
wiz2.load(inFile);
}
//Output the wizards to show data loaded correctly
cout<< "AFTER LOADING..." << endl;
wiz0.print();
wiz1.print();
wiz2.print();
}

Recommended Answers

All 4 Replies

i dont understand were the wiz0-2.save

That's not anywhere in your code.

That's not anywhere in your code.

I know that i dont understand where it comes from or why it is there.

why it is there.

It's not there.

lol!
These all probably come from "Wiz.h" file that's included in the code

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.