3
Contributors
7
Replies
8
Views
8 Years
Discussion Span
Last Post by clutchkiller
0

1 is a number.

'1' is a character.

So, it depends on which of the two you are going to use.

0

Thanks a lot Jobe, here is my code i am currently working on as of about 10 minutes ago.

#include <iostream>
#include <fstream>


using namespace std;

//SetConsoleTitle("ItemIzer");

int main()
{
    char cho
    
    cout<<"\n\n\n\n\t\t";
    cout<<"1: View Catagory";
    cout<<"2: Append new item";
    cout<<"3: Truncate an item";
    cout<<"4: Create Catagory";
    cout<<"5: Delete Catagory";
    
    do
    {
              bool repeat(false);
              cout<<">>";
              cin>>cho;
              
              switch (cho)
              {
                     case 1:
                     case 2:
                     case 3:
                     case 4:
                          void name;
                          ofstream Clist ("Catagorylist.txt", app);
                          cin>>name;
                          Clist<<name;
                     case 5:

Would everything in there be legal so far as long as i finishing declaring everything? Thanks

0

Since your switch variable cho is a char, your case labels must be like case '1': - the labels must be literal characters.

0

- char cho ;

- After each case you have to use a break; , otherwise, the program will fall threw to each case that is presented.

- I guess you haven't shown all the code, seeing as you didn't use close braces for the do loop and main.

0

Yes i understand i need to use break; =P

So what if i make cho an integer? Then it would be 1 and not '1' correct?

>> - the labels must be literal characters.

I got a long way to go lol. Thanks in advance

0

Yes i understand i need to use break; =P

So what if i make cho an integer? Then it would be 1 and not '1' correct?

>> - the labels must be literal characters.

I got a long way to go lol. Thanks in advance

Yep, like vmanes mentioned !

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.