//Program to collect and hold data on CD's
#include <iostream>
#include <fstream>
using std::cout;
using std::cin;
using std::endl;
using std::ifstream;

int main() {
    int QA;
    cout << "To veiw file press v, to add a new CD press a:\n";
    cin.get(QA);
    if (QA == v) {
        while (CDs.get(ch)) cout.put(ch);
    } 
    if (QA == a) {
        int bn;
        int an;
        cout << "Enter Band Name:";
        cin.get(bn); 
        cout << endl;
        ifstream CDs ("CDs.txt" ios::in);
        if (CDs.is_open() ) {
            CDs << bn << endl;
            CDs.close();
        }
        cout << "Enter Album Name:";
        cin.get (an);
        cout < endl;
        ifstream CDs ("CDs.txt" iost::in);
        if (CDs.is_open() ) {
            CDs << an << endl;
            CDs.close();
        }
        while (CDs.get(ch)) cout.put(ch);
        cin.get();
        return 0;
}

Ok, this is a program meant to store and alow you to see the CD's. First it ask's if you want to Veiw the CD's for Add a new CD. If you choose veiw, it shows them, if you choose add new it asks for the band name, then adds it to the file, then asks for the album name and adds it to. I dont understand how i even wrote this, and its giving me ALOT of errors. Any ideas whats wrong?

Recommended Answers

All 4 Replies

If the code contains as many spelling errors as your username I'm not surprised.

>Any ideas whats wrong?
Too much. There's no point in trying to fix something so broken, so start over, and this time use a C++ reference.

>Any ideas whats wrong?
Too much. There's no point in trying to fix something so broken, so start over, and this time use a C++ reference.

I was using a C++ Reference, i didnt understand it ;P. So until you can find a user-freindly to nubes tutorial on C++ im stucj in a ditch, i've searched high and low of the net, and the one im using now is the best, but in this case the worste. I dont understand it all to well. its the http://www.cPlusPlus.com one.

get yourself to a bookstore and order a copy of
1) Accellerated C++ by Koenig and Moo
and
2) The C++ Programming Language 3rd edition by Stroustrup

You might also want to pick up
3) C++ in a Nutshell by Lischner

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.