Okay... So I'm taking this c++ class. It's accelerated and I started off great but now... not so much. I've been searching the net trying to find a group of tutorials with quick examples for beginners. Something that clearly shows how to write and call functions. Read in data from a file... This class has totally left me behind and I need desperately to catch up. The text book assigned to the class isn't very helpful so if anyone knows of a location to find some tutorials for references I'd really appreciate it.

Thanks
Girl Interrupted
:confused:

Dani AI

Generated

Thread summary and a short, practical plan tied to the replies from , , , and .

If the course is moving too fast, focus on the essentials that return the biggest payoff quickly: how to declare/define/call functions, parameter passing (value vs reference), simple return values, and basic file input using the <fstream> family. Pair reading short reference pages with tiny, hands-on programs — writing and running something is the fastest way to learn. Take 's advice: talk to your tutor early (ask for extra practice or a slightly slower track). Also consider a clearer secondary textbook; and are right that a different book can help.

Small, repeatable example to practice: write a function that processes a line, and loop over lines read from a file.

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

void processLine(const std::string& s) {
    std::cout << "Length: " << s.size() << "\n";
}

int main() {
    std::ifstream in("input.txt");
    if (!in) {
        std::cerr << "Cannot open input.txt\n";
        return 1;
    }
    std::string line;
    while (std::getline(in, line)) {
        processLine(line);
    }
}

Practical tips and next steps: compile with warnings (g++ -std=c++17 -Wall -Wextra -o prog prog.cpp), fix the first compiler error before moving on, run from the folder that contains input.txt or give an absolute path, and use a debugger or simple std::cout traces when stuck. For modern, stepwise tutorials and a concise reference consult Learn C++ (learncpp.com) and C++ reference (cppreference.com). Recommended books (no links): "Accelerated C++", "C++ Primer", and Stroustrup's "Programming: Principles and Practice Using C++".

Recommended Answers

All 4 Replies

I would suggest that Google is your friend. Search for c++ tutorials and you'll find many. Only you can tell if one is suitable to your needs.

Beware of any that still use the older standards for C++ - you'll spot these when they use header files such as <iostream.h> <fstream.h> and many other libraries ending in ".h" (although some of the .h from the C libraries are still used.)

Is there any specific topic that is giving you problems?

Val

> So I'm taking this c++ class. It's accelerated and I started off great but now... not so much
Perhaps you chose the wrong class then.

Talking to your tutor would be a good idea at this stage, especially if this is early on in the course. Maybe you can get bumped onto an easier schedule.

Salem is right...

>>to find a group of tutorials with quick examples for beginners
I am not a fan of tutorials...maybe you should try reading a {beginner or intermediate} book on c++.....

If you get a book (which I would recommend if you're not satisfied with the current text) I would recommend this
I have the 2nd edition of this book and so far in my college career, this has been the best written text book I've used.

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.