Dear Colleague,

I have some experience with turbo c++, but now I have an assignment to be done using Dev C++.

Is there anyone who can give me an idea about this Dev C++. It is Good if it is supported with some sample program that use classes and files.

hope....soon
regards,

ben

Dani AI

Generated

asked for a Dev-C++ example using classes and files; suggested inspecting IDE resources. The following adds a small, practical example plus tips that work for assignments and will run on classic Dev-C++ setups.

Dev-C++ is an IDE that commonly bundles the MinGW/GCC toolchain, so programs are compiled by GCC rather than the old Turbo C++ compiler. That means standard C++ code is the right target; however, older Dev-C++ distributions include an old GCC with limited C++11 support. The sample below deliberately uses C++98-style facilities (sstream, fstream) to maximize compatibility. If later C++ standards are required, enable the appropriate compiler flag (or install a newer compiler/fork).

#include <iostream>
#include <fstream>
#include <sstream>
#include <string>

class Person {
public:
    std::string name;
    int age;
    Person() : name(""), age(0) {}
    Person(const std::string &n, int a) : name(n), age(a) {}
    std::string serialize() const {
        std::ostringstream oss;
        oss << name << "," << age;
        return oss.str();
    }
    static Person deserialize(const std::string &line) {
        std::istringstream iss(line);
        Person p;
        if (std::getline(iss, p.name, ','))
            iss >> p.age;
        return p;
    }
};

int main() {
    std::ofstream out("people.txt");
    out << Person("Alice", 30).serialize() << std::endl;
    out << Person("Bob", 25).serialize() << std::endl;
    out.close();

    std::ifstream in("people.txt");
    std::string line;
    while (std::getline(in, line)) {
        Person p = Person::deserialize(line);
        std::cout << p.name << " " << p.age << std::endl;
    }
    return 0;
}

Save as a .cpp source and compile inside Dev-C++. Common troubleshooting: confirm the working directory where the executable runs (relative paths write/read there); check file streams with if (!out) or if (!in) to detect open failures; if errors mention to_string or stoi, those need C++11—either enable the standard flag or update the compiler. For assignments that referenced Turbo-specific headers (conio.h, etc.), prefer standard headers shown above to keep code portable.

Recommended Answers

All 2 Replies

is a few free source files -- browse around that site and you might find additional help. Otherwise its just a c and c++ compiler that compiles normal programs.

Browse around your compiler's menues and test out some of its options. That's the best way to learn it. Start with File --> New --> Project.

Narue,

Thank u for ur interest to help me. and thank u very much. I'll try to do it

regards,

ben

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.