Talk About Network

Google





Programming > C - C++ Learning > Re: Problem wit...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 15 Topic 4080 of 4400
Post > Topic >>

Re: Problem with compilator DEV C++

by "lito" <lit@[EMAIL PROTECTED] > Mar 25, 2008 at 05:51 PM

Thank you for your answer.
The complete Main is:

#include <cstdlib>
#include <iostream>

using namespace std;
using std::cout;
using std::endl;

#include "GradeBook.h"

int main(int argc, char *argv[])
{

    // creazione di due oggetti GradeBook
GradeBook gradeBook1("CS01 Introduzione a C++");
GradeBook gradeBook2("CS02 Strutture dati in c++");

// visualizza il nome inizale del corso
cout<< "gradeBook1 creato corso " << gradeBook1.getCourseName() << endl;
cout << "  " << endl;
cout<< "gradeBook2 creato corso " << gradeBook2.getCourseName() << endl;
    system("PAUSE");
    return EXIT_SUCCESS;

}

"osmium" <r124c4u102@[EMAIL PROTECTED]
> ha scritto nel messaggio 
news:64slujF2dcfhiU1@[EMAIL PROTECTED]
> "lito" wrote:
>
>> Excuse for my english
>> I have a problem with implementation of a class. I write the code
>>
>> // GradeBooh.h
>> // questo file contiene la definizione della  classe GradeBook.h
>> #include <string>
>> using std::string;
>
> That's a very bad practice.  Confine using directives to cpp files, this

> exposes the using all over the place.
>
>> class GradeBook
>> {
>>      public:
>>             GradeBook(string); // costruttore
>>             void setCourseName (string); // imposta il nome del corso
>>             string getCourseName (); //legge nome del corso
>>             void displayMessage(); //visualizza messaggio di benvenuto
>>      private:
>>              string courseName; //nome del corso GradeBook
>> };
>> that contain the definition of a GradeBook class.
>> Then a wirte the file GradeBook.cpp that contain the implementation of 
>> the class
>>
>> // GradeBook.cpp
>> // questo file contiene l'implementazione della classe che dovrà
rimanere
>> // nascosta a tutti
>> #include <iostream>
>> using std::cout;
>> using std::endl;
>>
>> #include "GradeBook.h"  //include la definizione della classe
>>
>> //COSTRUTTORE
>> GradeBook::GradeBook(string name)
>> {
>>    setCourseName(name);
>> }// fine costruttore
>>
>> //funzione per impostare il nome del corso
>> void GradeBook::setCourseName(string name)
>> {
>>     courseName = name;  // MEMORIZZA NOME DEL CORSO
>> }
>>
>> // leggo nome del corso
>> string GradeBook::getCourseName()
>> {
>>     return courseName;
>> }
>>
>> // visualizza messaggio di benvenuto
>> void GradeBook::displayMessage()
>> {
>>     cout<< "Benvenuto al corso " <<getCourseName () << "! " << endl;
>> }
>>
>> but the compiler don't compile the file GradeBook.cpp.
>
> Compiles for me on DEV-C when I include a main function.  If you want
help 
> with a PROGRAM, post a PROGRAM.  The thing you posted is fragments of a 
> program.
>
 




 15 Posts in Topic:
Problem with compilator DEV C++
"lito" <lit@  2008-03-25 14:58:45 
Re: Problem with compilator DEV C++
"osmium" <r1  2008-03-25 08:01:24 
Re: Problem with compilator DEV C++
"lito" <lit@  2008-03-25 17:51:10 
Re: Problem with compilator DEV C++
"osmium" <r1  2008-03-25 10:29:50 
Re: Problem with compilator DEV C++
Francis Glassborow <fr  2008-03-25 18:57:21 
Re: Problem with compilator DEV C++
Francis Glassborow <fr  2008-03-25 18:55:53 
Re: Problem with compilator DEV C++
"osmium" <r1  2008-03-25 11:14:09 
Re: Problem with compilator DEV C++
Francis Glassborow <fr  2008-03-26 11:15:36 
Re: Problem with compilator DEV C++
Jerry Coffin <jcoffin@  2008-03-26 07:47:57 
Re: Problem with compilator DEV C++
"osmium" <r1  2008-03-26 06:32:07 
Re: Problem with compilator DEV C++
Francis Glassborow <fr  2008-03-26 23:40:18 
Re: Problem with compilator DEV C++
Jerry Coffin <jcoffin@  2008-03-26 19:06:20 
Re: Problem with compilator DEV C++
Francis Glassborow <fr  2008-03-27 11:40:35 
Re: Problem with compilator DEV C++
Jerry Coffin <jcoffin@  2008-03-28 21:04:50 
Re: Problem with compilator DEV C++
Bart van Ingen Schenau &l  2008-03-25 20:28:41 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Wed Jan 7 13:05:52 PST 2009.