By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,998 Members | 2,773 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,998 IT Pros & Developers. It's quick & easy.

My Main problem is........................?

P: 14
my task is to create a game and I don't know what is wrong with my main(s). I was instructed there were to be 2. one for game and one for character.

#include <iostream>
#include <string>
#include <cstdlib>
#include "character.h"
//#include "game.h"
using namespace std;

int main( string hair ,string eyes, char name, int strength, int health,int level , string location) {


Character p1 ("brown", "blue", "Batman",100, 100, 0, "");//p2
p1.setName([Batman]);
p1.setHair("black");
p1.setEyes("blue");
p1.setStrength (95);
p1.setHealth (45);
p1.setLevel (1);
p1.setLocation ("woods");
cout<< endl;
cout<< "p1"<<endl;
cout<<name<<endl;
cout<<hair<<endl;
cout<<eyes<<endl;
cout<<strength<<endl;
cout<<health<<endl;
cout<<level<<endl;
cout<<location<<endl;
p1.print();
cout<< endl;

cout<< endl;
cout<< "p2"<< endl;
p2.print();
cout<< endl;

//p2=c;

Character p3(p2);
cout<< endl;
p3.print();
cout<< endl;


//system ("PAUSE");
return 0 ;
}

#include <isotream>
#include <string>
#include <cstdlib>
#include "character.h"
#include "game.h"
using namespace std;

int main(string PlayerOne ,string PlayerTwo , string hair ,string eyes, char name, int strength, int health,int level , int location) {

Game p2, p1("brown", "blue", 100, 100);

p1.setHealth(100);
p1.setLevel(2);
p1.setStrength (95);
p1.setHealth (45);

cout<< endl;
cout<< "p1"<<endl;
p1.print();
cout<< endl;

cout<< endl;
cout<< "p2"<< endl;
p2.print();
cout<< endl;

//p2=c;

Game p3(p2);
cout<< endl;
p3.print();
cout<< endl;
Sep 22 '06 #1
Share this Question
Share on Google+
1 Reply


Banfa
Expert Mod 5K+
P: 8,916
my task is to create a game and I don't know what is wrong with my main(s). I was instructed there were to be 2. one for game and one for character.
I doubt it, there can only be 1 main in a program, the C standard says so.

Exactly 1 main
0 is too few
2 is too many
and 3 is right out.


I suspect that you were told that there would have to be 2 classes. Alternatively this games runs as several programs.
Sep 22 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.