If kommando, kan ikke få den til at virke
#include <iostream.h>#include <conio.h>
#include <stdlib.h>
#include <fstream.h>
void main(void)
{
struct temp{
char weapon[255];
} itemp = {""};
struct player {
char name[255];
char weapon[255];
int age;
int level;
int exp;
} info = {"", "", 20 ,0 ,0 };
ifstream player_fil("player.dat");
player_fil.read((char *)
&info, sizeof(player));
cout << "Name : " << info.name << endl;
cout << "Age : " << info.age << endl;
cout << "level : " << info.level << endl;
cout << "Exp : " << info.exp << endl;
cout << "Weapon: " << info.weapon << endl;
system("PAUSE");
cout << "RRRRR PPPPP GGGGG" << endl;
cout << "RR R PP P GG " << endl;
cout << "RRRRR PPPPP GG GGG" << endl;
cout << "RR RR PP GG GG" << endl;
cout << "RR RR PP GGGGG" << endl;
cout << "----------------------" << endl;
cout << "Version 1.0.0 official" << endl;
cout << "----------------------" << endl;
cout << "Chapter 1" << endl;
cout << "--------------" << endl;
cout << "You are standing in the big Hall of Silver, you dont know, what you " << endl;
cout << "are doing there, at you left there is a sword, and on you right there" << endl;
cout << "is a axe, you can only carry one of them." << endl;
// --------------------------------------------------
// kan ikke få denne if kommando til at virke
// så den kæmmer Axe eller Sword i player.dat filen,
// kig neden under denne tekst.
// --------------------------------------------------
cout << "Sword or Axe?";
cin >> itemp.weapon;
if(itemp.weapon == "Sword")
{
info.weapon == "Sword";
}
else if(itemp.weapon == "Axe")
{
info.weapon == "Axe";
}
else
{
info.weapon == "None";
}
cout << "You pick up the " << itemp.weapon << " and move on" << endl;
ofstream player1_fil("player.dat");
player1_fil.write((char *)
&info, sizeof(player));
system("PAUSE");
}
