assigment is due in a week need help

hey guys i recently was assigned with an assesment on c++ to make a date validation and modulus 10 isbn number check. but im getting mad errors and the code its not working ;-; could someone guide me or help me to finish my code ? thanks in advance, and apologize for my horible english coments i was in a super hurry ;-;


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#include <iostream> // cout cin
#include <limits> // numeric limits
using namespace std; // avoid using std::cout, std::cin
void drawMenu()
{
    // menu
    cout <<"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" << endl;
    cout <<" Choose an entry from 1 to 3.             " << endl;
    cout <<"    [1] Validate modulus 11 number.       " << endl;
    cout <<"    [2] Validate date.                    " << endl;
    cout <<"    [3] Quit                              " << endl;
    cout <<"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" << endl;
}

int main()
{
// we can create a game lopop forr this aplitcatoin

    bool quit = false; // we habvent quitter ywt
    do
    {
        // user cohise
        int choice;
        
        // print mnu
        drawMenu();
        
        // get tghe suere cohihes
        cin >> choice;
        
        
        //error check agani unclude the fact that the number has to be 1-3 while 
        while(cin.fail() || choice < 1 || choice > 3)
        {
            cout << endl << "choose a correct entry from 1 to 3 (with numbers)"
                 << endl << endl;
            cin.clear();
            
            cin.ignore(numeric_limits<streamsize>::max(),  '\n');
            
            // drawmyny
            drawMenu();
            cin >> choice;
        }
// check the chouidde we hacve recieved
    switch (choice)
    {
        case 1: // if hte coihed is 1
        cout << endl << "Enter an ISBN number: " << endl << endl;
        break;
    case 2 :
        int day,dd,mm,yy,num;
    char ans;
    
    label_important:
    do{
    cout<<"Enter day: \n";
    cin>> dd;
    }while (dd<1||dd>31);

    do{
    cout<<"Enter month: \n";
    cin>> mm;
    }while (mm<1||mm>12);
    
    do{
    cout<<"Enter year: \n";
    cin>> yy;
    }while (yy<1||yy==num);
    
    //validation
    
    switch(mm){
	case 1:if (1,3,5,7,8,10,12);
	day=31;
	break;
	case 2: if (4,6,9,11);
	day=30;
	break;
	case 3:
	if(((yy%4==0)&&(yy%100!=0)) || (yy%400==0))
	day=29;
	else
	day=28;
	
    }
    // the last bit that makes sure if the date is valid or no
    if (dd, mm, yy)
    cout<<"The Date "<<mm<<'/'<<dd<<'/'<<yy<<" is Valid!"<<endl;
    else 
    cout<<"The Date "<<mm<<'/'<<dd<<'/'<<yy<<" is Invalid"<<endl;
    
    //{
        cout<<"Do You want to go back to menu? (y/n) "<<endl;
        cin>>ans;
    if (ans = 'y') goto label_important;

        break;
    case 3:
        quit = true;
        break;
    default:
        break;
    }
}while (!quit); // keep lopoing foiorvfer until wee quiot

// bye
cout << endl << "Shutting down. Bye :) " << endl << endl;
return 0;
}




and the worst error i get is this:
http://postimg.org/image/gjw48kak7/

it should bring me back to the menu at the start

thanks for the help in advance
Last edited on
closed account (48bpfSEw)
please avoid "goto" in CPP code!


hint for the bug: if you press "y" and enter. the buffer contains y and char(13) (ENTER). you should flush the buffer before get the next input.
i really dont wanna sound rude but i know nothing about cpp... ;-; this is what me and my teacher came up with... and she cant help me anymore so im on my own, and i have no clue on what to do so saying a hint is like throwing a brick at a wall = nothing happens ;-;
Last edited on
closed account (48T7M4Gy)
http://pastie.org/pastes/10761665
closed account (48bpfSEw)
you have to throw a lot of bricks at a wall to get at last a break-through! ;-)
i mean i didnt understand the "flush the buffer" or half or what i did in this program, but if you could give easier to understand hints i would be gratefull :) i just need to make this work for my assesment
closed account (48T7M4Gy)
http://www.cplusplus.com/forum/general/192758/
http://www.cplusplus.com/forum/general/192757/
http://www.cplusplus.com/forum/general/192756/
Last edited on
kemort thats probably my class mates asking for help to ;-;
closed account (48T7M4Gy)
What is line 49 about?
thats a thing we need to do thats 10 number that are added up and divided by 11 to see if its a correct number, but i dont know how to write a code for it
Last edited on
Topic archived. No new replies allowed.