Click here to Skip to main content
15,885,537 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
im having trouble running this and i am trying to make a rpg charater creator a simple one and i cant run it

What I have tried:

using System;

class MainClass 
{
  public static void Main (string[] args) 
  {
   register pr = new register();
   stats pa = new stats();
   Console.Write("Enter Name: ");
   string name = Console.ReadLine();
   Console.Write("Enter Race: ");
   string race = Console.ReadLine();
   Console.Write("Choose class: ");
   string jobs = Console.ReadLine();
   string p = pr.race(race);
   string z = pr.jobs(jobs);
   int b = pa.hp(jobs);
   int c = pa.level();
   int d = pa.strength();
   int e = pa.dexterity(race);
   int f = pa.constitution(race);
   Console.Write("\n");
   Console.WriteLine("Name: {0} Level: {1}",name,c);
   Console.WriteLine("Race: {0}",p);
   Console.WriteLine("Class: {0}",z);
   Console.WriteLine("Abilities");
   Console.WriteLine("Strength: {0}", d);
   Console.WriteLine("Dexterity: {0}", e);
   Console.WriteLine("Constitution: {0}", f);
   Console.WriteLine("HP: {0}",b);
  }
}
Posted
Updated 29-May-21 4:17am
Comments
Richard MacCutchan 29-May-21 8:56am    
What exactly is the problem?
BillWoodruff 29-May-21 9:03am    
We can't read your mind ! You need to describe your goal, and what does and does not work in detail. Show the code for 'register and 'stats
ikaros 817 29-May-21 9:38am    
it doesnt start
i am new and this the compiler says

Compilation error (line 7, col 4): The type or namespace name 'register' could not be found (are you missing a using directive or an assembly reference?)
Compilation error (line 7, col 22): The type or namespace name 'register' could not be found (are you missing a using directive or an assembly reference?)
Compilation error (line 8, col 4): The type or namespace name 'stats' could not be found (are you missing a using directive or an assembly reference?)
Compilation error (line 8, col 19): The type or namespace name 'stats' could not be found (are you missing a using directive or an assembly reference?)
Patrice T 29-May-21 10:04am    
Use Improve question to update your question.
So that everyone can pay attention to this information.

You don't have a register class defined anywhere, nor a stats class.

Nobody can fix that for you. You have to write those classes for this code to compile.
 
Share this answer
 
The compiler can't "invent" classes for you based on how you might be using them - the whole idea is that you need to write the classes to do exactly what you want, and populate them with properties and methods to allow the outside world to interface with them.
It's like driving a car: the mechanics of getting the whole vehicle to accelerate or slow down are irrelevant to most drivers as long as they can push the right pedal to go faster, and the middle / left pedal to go slower.
That's the "driving interface" - the mechanics of getting the right amount of fuel into the engine at the right time and so forth are implemented by the manufacturer when they design the car.

But now you are designing the car - so you have to produce the "hardware" that converts a pedal being pushed into more of less speed.

So start by working out what the classes have to do, and then sort out how the outside world needs to interact with them to do what it wants.
Then implement the properties and methods to do it!

And do yourself a favour: stop using single character names for everything - you may remember that "e" is the "dexterity" today, but when you have to modify it in three weeks time, will you then? Use descriptive names - "dexterity" , or "dex" for example - and your code becomes easier to read, more self documenting, easier to maintain - and much more reliable as you can't us eteh wrong name so easily and it's more obvious when you do ...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900