Tag Archive for 'Portable'

Simple C++ List Class

Just as I published some days ago the Simple C++ String Class as a C++ learning exercise, now I am freeing a Simple C++ List Class.

The standard library has a list class. But, while learning, it’s a good idea to know how to develop your own list class.

That’s why I made the List class. It’s not intended for professional projects (for them, you should use the standard library’s list), but as help to learn C++.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
template <class TYPE>
class List
{
    /* ... */
 
public:
    //Construction and destruction
    List() { /* ... */ }
    ~List() { /* ... */ }
     
    List(const List& rlList) { /* ... */ }
     
    //Assignment operator
    List& operator=(const List& rlList);
 
    //Information
    int Length() { /* ... */ }
    bool Empty() { /* ... */ }
 
    //Element managing
    int Add(TYPE& rtData);
    TYPE* Elem(int nPos);
    bool Delete(int nPos);
    void DeleteAll();
     
    //Search
    int Find(TYPE& rItem, int nStartAt = 0);
 
    //Operadores
    TYPE& operator[](int nPos) { /* ... */ }    //Elem
    int operator<<(TYPE& rdData) { /* ... */ }    //Add
 
protected:
    void FreeList();
    void Init() { /* ... */ }
};
 
//Output
template <class TYPE>
std::ostream& operator<<(std::ostream& oStream, List<TYPE>& rlList);

Keep reading…

Incoming search terms for the article:

Simple C++ String Class

Every C++ programmer knows that the standard library has a string class. But, while learning, it’s a good idea to know how to develop your own string class.

That’s why I made the String class. It’s not intended for professional projects (for them, you should use the standard library’s string), but as help to learn C++.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
class String
{
    char *m_pszString;  //Allocated buffer
    int m_nAllocated;   //Allocated length
 
public:
    //Construction and destruction
    String() { /* ... */ }
    ~String() { /* ... */ }
 
    //Copy constructors
    String(const char *pszString) { /* ... */ }
    String(const String& rsString) { /* ... */ }
 
    //Operators (assignment)
    String& operator=(const char *pszString);
    String& operator=(const String& rsString) { /* ... */ }
 
    //Operators (concatenation)
    String& operator+=(const char *pszString);
    String& operator+=(String& rsString) { /* ... */ }
    String operator+(String rsString);
 
    //Operators (comparison)
    bool operator<(String sString) { /* ... */ }
    bool operator<=(String sString) { /* ... */ }
 
    bool operator>(String sString) { /* ... */ }
    bool operator>=(String sString) { /* ... */ }
 
    bool operator==(String sString) { /* ... */ }
    bool operator!=(String sString) { /* ... */ }
 
    //Operations
    void Clear();
    String Lower() { /* ... */ }
    String Upper() { /* ... */ }
 
    //Information
    int Length() { /* ... */ }
 
    //Cast operators
    operator const char*() { /* ... */ }
 
protected//Helper functions
    /* ... */
};
 
//Output e input
std::ostream& operator<<(std::ostream& oStream, String& rsString);
std::istream& operator>>(std::istream& iStream, String& rsString);

Keep reading…

Incoming search terms for the article:

Attendance Control (wxWidgets Version)

wxAttendanceControl is a GUI version of Attendance Control.

It’s been prepared as a further introduction exercise to the wxWidgets GUI (Graphical User Interface) usage (the basic introduction exercise was the Celsius to Fahrenheit application).

For the complete exercise explanation please visit the original Attendance Control exercise.

wxControlAsistencia1

Keep reading…

Incoming search terms for the article:

Celsius to Fahrenheit

If you just want to convert temperatures by using a website, you should visit the online celsius to fahrenheit conversion tool. Otherwise, keep reading…

This is a very tiny and simple application I’ve written to teach the basic usage of wxWidgets as an introduction to GUI (Graphical User Interfaces).

Its purpose is just what it’s name says: converting from celsius degrees to fahrenheit degrees (and sideways).

CelsiusAFahrenheit

Keep reading…

Incoming search terms for the article:

Attendance Control

“Attendance Control” is a console application made as an exercise to integrate the different C++ concepts taught in class up to the middle of the year.

The main objective is to be able to develop a employee attendance control which records the times (and justifications, if corresponding) of each time the employees arrive, go to lunch, return from lunch and go back to home.

Sistema de control de asistencia de personal
--------------------------------------------

DNI:

Keep reading…

Incoming search terms for the article: