Using System
Using System
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp5
{
class Program
{
public class appartement
{
public int num;
public int etage;
public int nbp;
public appartement() : this(0, 0, 0) { }
public appartement(int x, int y, int z)
{
num = x;
etage = y;
nbp = z;
}
public void saisir()
{
Console.WriteLine("donner un num");
num = Int32.Parse(Console.ReadLine());
Console.WriteLine("donner un etage");
etage = Int32.Parse(Console.ReadLine());
Console.WriteLine("donner nbp");
nbp = Int32.Parse(Console.ReadLine());
}
}
public void saisir()
{
for (int i = 0; i < lesapp.Length; i++)
{
lesapp[i] = new appartement();
lesapp[i].saisir();
}
}
public void afficher()
{
foreach (appartement b in lesapp)
b.afficher();
}
public int NbTotale()
{
int ps = 0;
foreach (appartement b in lesapp)
{
ps = ps + b.nbp;
}
return ps;
}
}
}