Help on begginer project

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2008
Posts: 111
Reputation: clutchkiller is an unknown quantity at this point 
Solved Threads: 1
clutchkiller's Avatar
clutchkiller clutchkiller is offline Offline
Junior Poster

Help on begginer project

 
0
  #1
Nov 13th, 2008
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 =)
  1. #include <iostream>
  2. #include <fstream>
  3. #include <windows.h>
  4.  
  5. using namespace std;
  6.  
  7. /*
  8.   Name:
  9.   Copyright:
  10.   Author:
  11.   Date: 12/11/08 19:42
  12.   Description:
  13. */
  14.  
  15.  
  16.  
  17. int main()
  18. {
  19. cout<<"\n\n\n\n";
  20. cout<<"\t1: View Catagory"<<endl;
  21. cout<<"\t2: Append new item"<<endl;
  22. cout<<"\t3: Truncate an item"<<endl;
  23. cout<<"\t4: Create Catagory"<<endl;
  24. cout<<"\t5: Delete Catagory"<<endl;
  25.  
  26. do
  27. {
  28. int cho;
  29. bool repeat(false);
  30. cout<<">>";
  31. cin>>cho;
  32.  
  33.  
  34. switch (cho)
  35. {
  36. case 1:
  37. Clist.open();
  38. cout<<Clist;
  39. cout<<"What catagory would you like to view?";
  40.  
  41. case 2:
  42.  
  43. case 3:
  44.  
  45. case 4:
  46. int name;
  47. cout<<"Title>>";
  48. cin>>name;
  49. ofstream Clist ("Catagorylist.txt", ios::app);
  50. Clist<<name;
  51. Clist.close();
  52. break;
  53.  
  54. case 5:
  55.  
  56. default:
  57. cout<<"Bad user input, please select a menu option";
  58. repeat(true);
  59. }
  60. }
  61. 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.
Last edited by clutchkiller; Nov 13th, 2008 at 12:09 am.
>That confuses me =(
Get used to it. Good programmers are in a constant state of confusion.
>Looks like i have some quasi specifics to investigate! Up Up And AWAY!
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 111
Reputation: clutchkiller is an unknown quantity at this point 
Solved Threads: 1
clutchkiller's Avatar
clutchkiller clutchkiller is offline Offline
Junior Poster

Re: Help on begginer project

 
0
  #2
Nov 13th, 2008
bump
>That confuses me =(
Get used to it. Good programmers are in a constant state of confusion.
>Looks like i have some quasi specifics to investigate! Up Up And AWAY!
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,826
Reputation: ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all 
Solved Threads: 117
ithelp's Avatar
ithelp ithelp is offline Offline
Posting Virtuoso

Re: Help on begginer project

 
0
  #3
Nov 13th, 2008
Where is Clist defined , is it your code ?
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 273
Reputation: Sci@phy will become famous soon enough Sci@phy will become famous soon enough 
Solved Threads: 42
Sci@phy's Avatar
Sci@phy Sci@phy is offline Offline
Posting Whiz in Training

Re: Help on begginer project

 
0
  #4
Nov 13th, 2008
What do you really want? How to create Clist? or?
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 111
Reputation: clutchkiller is an unknown quantity at this point 
Solved Threads: 1
clutchkiller's Avatar
clutchkiller clutchkiller is offline Offline
Junior Poster

Re: Help on begginer project

 
0
  #5
Nov 13th, 2008
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.
>That confuses me =(
Get used to it. Good programmers are in a constant state of confusion.
>Looks like i have some quasi specifics to investigate! Up Up And AWAY!
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 2,839
Reputation: niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute 
Solved Threads: 298
Moderator
Featured Poster
niek_e's Avatar
niek_e niek_e is offline Offline
Roasting Maven

Re: Help on begginer project

 
0
  #6
Nov 13th, 2008
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:
  1. Clist.open();
  2. 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...
Last edited by niek_e; Nov 13th, 2008 at 9:08 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC