Hi guys, right now I am an amateur in the world of programming and am starting to "train" myself by thinking of ideas for a program and figuring out how to write it.

So right now, my first real undertaking I have devised is to write an itemizer where the user can create different categories and place items in each category to keep track of different things.

Here is my code so far which is pretty self explanatory. Not all the cases are filled yet, and int cho is considered the menu option that the user inputs. int cho("choice") =D

consider this thread to be a CVS of sorts =)

#include <iostream>
#include <fstream>
#include <windows.h>

using namespace std;

/*
  Name: 
  Copyright: 
  Author: 
  Date: 12/11/08 19:42
  Description: 
*/



int main()
{
    cout<<"\n\n\n\n";
    cout<<"\t1: View Catagory"<<endl;
    cout<<"\t2: Append new item"<<endl;
    cout<<"\t3: Truncate an item"<<endl;
    cout<<"\t4: Create Catagory"<<endl;
    cout<<"\t5: Delete Catagory"<<endl;

    do
    {
              int cho;  
              bool repeat(false);
              cout<<">>";
              cin>>cho;
              
              
              switch (cho)
              {
                     case 1:
                          Clist.open();
                          cout<<Clist;
                          cout<<"What catagory would you like to view?";
                          
                     case 2:
                          
                     case 3:
                          
                     case 4:
                          int name;
                          cout<<"Title>>";
                          cin>>name;
                          ofstream Clist ("Catagorylist.txt", ios::app);
                          Clist<<name;
                          Clist.close();
                          break;
                          
                     case 5:
                          
                     default:
                             cout<<"Bad user input, please select a menu option";
                             repeat(true);
                             }
                             }
                     while (repeat);

So I am looking for advice on how to piece this all together. I am not aware of all the techniques and different functions that I can use to accomplish this feat which is why I am looking for guidance and help. Thank you very much in advance for any knowledge or solutions you have to offer me.

If their are any unclear parts of the code please ask me!

Please note that I am trying to keep my code in c++ syntax.

Well im trying to create a clist to write to txt files using the <fstream> header to store peoples categories and items that they decide to create so that they can look them up later or add to them.

A few tips:

in case 1:
you're using the variable Clist which isn't declared yet. (you're declaring it in case 4)

This:

Clist.open();
cout<<Clist;

is not the way to view a text-file. Here's a tutorial.

You should always check if opening your file succeeded, before trying to read or write.

And a few other things, but fix these first.

And now for the most important tip: Bumping threads is very impolite and you're very lucky I'm in such a good mood...

This article has been dead for over six months. Start a new discussion instead.