[ create a new paste ] login | about

Link: http://codepad.org/vaDrCIn3    [ raw code | output | fork ]

C++, pasted on Jan 19:
#include <ostream>
#include <string>

class Student{
private:
    string name;
    string fakn;
    double srus;
public:
    Student( string n, string f ) {
        name = n;
        fakn = f;
        srus = 0;
    }
    friend std::ostream& operator<<(std::ostream& stream, const Student& s);
};
std::ostream& operator<<(std::ostream& output, const Student& s){
    output<<"\nIme: "<<s.name<<"\nFakulteten nomer: "<<s.fakn<<"\nSreden uspeh: "<<s.srus<<endl;
    return output;
}

int main( ) {
    Student test( "Bob", "that" );
    std::cout << test << std::endl;
    return 0;
}


Output:
1
2
3
4
5

Ime: Bob
Fakulteten nomer: that
Sreden uspeh: 0



Create a new paste based on this one


Comments: