Entrée de données / Programmation orientée objet

Résolu/Fermé
tkp92 Messages postés 14 Date d'inscription vendredi 21 juin 2013 Statut Membre Dernière intervention 11 février 2014 - 23 janv. 2014 à 01:31
tkp92 Messages postés 14 Date d'inscription vendredi 21 juin 2013 Statut Membre Dernière intervention 11 février 2014 - 23 janv. 2014 à 03:13
Salut à tous ,
j'aurais une question que vous jugeriez surement débile . Savez vous comment faire pour que l'utilisateur de mon programme puisse introduire ses propres données ?
voici mon programme :
#include "Student.h" ;
#include "Dozent.h" ;
#include <iostream> ;
void main (void) 
{
Cperson person("Jimi" , "Hendrix") ;
CStudent student("Janis" , "Joplin" , 4101970) ;
CDozent dozent("Kurt" , "cobain" , "kurt.cobain@gmail.com" ) ;
person.Ausgabe();
student.Ausgabe();
dozent.Ausgabe();


system ("pause") ;
}
#pragma once
#include "cperson.h"
class CStudent :
	public Cperson
{
private:
		int m_matrikelnummer ;
public:
	CStudent();
	CStudent(string vorname , string nachname , int matrikelnummer ) ;
	int GetMatrikelnummer() ;
	void SetMatrikelnummer ( int matrikelnummer ) ;
	void Ausgabe() ;
	~CStudent() ;
};
#include "Student.h"


CStudent::CStudent()
{
}
CStudent::CStudent(string vorname ,string nachname ,int matrikelnummer )
{
	SetVorname(vorname) ;
	SetNachname(nachname) ;
	m_matrikelnummer = matrikelnummer ;
}
int CStudent::GetMatrikelnummer()
{
	return m_matrikelnummer ;
}
void CStudent::SetMatrikelnummer(int matrikelnummer)
{
	m_matrikelnummer = matrikelnummer ;
}
void CStudent::Ausgabe()
{
	cout << "Matrikelnummer   : " << m_matrikelnummer << endl ;
}
CStudent::~CStudent()
{
}
#pragma once
#include "cperson.h"
class CDozent :
	public Cperson
{
private:
	string m_mail ;
public:
	CDozent();
	CDozent(string vorname , string nachname , string mail) ;
	string GetMail() ;
	void SetMail (string mail) ;
	void Ausgabe() ;
	~CDozent() ;

};
#include "Dozent.h"


CDozent::CDozent()
{
}
CDozent::CDozent(string vorname , string nachname , string mail )
{
	SetVorname(vorname) ;
	SetNachname(nachname) ;
	m_mail = mail ;
}
string CDozent::GetMail()
{
	return m_mail ;
}
void CDozent::SetMail(string mail)
{
	m_mail = mail ;
}
void CDozent::Ausgabe()
{
	cout << "Mail     :  " << m_mail << endl ;
}

	CDozent::~CDozent(void)
{
}
#pragma once
#include <iostream>
#include <string>
using namespace std ;
class Cperson
{
private:
	string m_vorname ;
	string m_nachname ;
public:
	Cperson();
	Cperson ( string vorname , string nachname );
	string GetVorname() ;
	void SetVorname( string vorname ) ;
	string GetNachname() ;
	void SetNachname(string nachname) ;
	void Ausgabe() ;
	~Cperson() ;
};
#include "Cperson.h"


Cperson::Cperson()
{
}
Cperson::Cperson(string vorname , string nachname)
{
	m_vorname = vorname , m_nachname = nachname ;
}
string Cperson::GetVorname()
{
	return m_vorname ;
}
void Cperson::SetVorname(string vorname)
{
	m_vorname = vorname ;
}
string Cperson::GetNachname()
{
	return m_nachname ;
}
void Cperson::SetNachname(string nachname)
{
	m_nachname = nachname ;
}
void Cperson::Ausgabe()
{
	cout << " Vorname   : " << m_vorname << endl ;
	cout << " Nachname  : " << m_nachname << endl ;
}
Cperson::~Cperson(void)
{
}



vous l'aurez surement compris , je programme en allemand ; et ce , parce que je poursuis mes etudes en Allemagne .
Merci à vous , au revoir .

1 réponse

aramir Messages postés 939 Date d'inscription mardi 26 février 2008 Statut Membre Dernière intervention 26 décembre 2016 222
Modifié par aramir le 23/01/2014 à 03:24
commentcamarche.net a pour politique de ne jamais faire les devoirs des autres. En revanche on peut toujours t'indiquer comment faire, ou te donner les éléments qui te manquent.
Alors, cadeau. Tu devrais pouvoir trouver ton bonheur avec une de ces deux méthodes:

http://www.cplusplus.com/reference/cstdio/scanf/?kw=scanf
http://www.cplusplus.com/reference/cstdio/gets/?kw=gets

Chacune ont leurs inconvéneients et leurs avantages. A toi de choisir.

Une fois le problème résolu, pensez à le notifier dans l'intitulé du forum.
En sélectionnant "marquer comme résolu" dans votre premier post.
0
tkp92 Messages postés 14 Date d'inscription vendredi 21 juin 2013 Statut Membre Dernière intervention 11 février 2014
23 janv. 2014 à 03:13
ok merci .
0