trouble reading input

Pages: 12
closed account (1Ck93TCk)
nevermind
Last edited on
If I was you, I'd fix up these errors first and re-edit your post :)

In function 'void displayAll(songType*, int&)':
134:9: warning: unused variable 'entry' [-Wunused-variable]
 At global scope:
180:6: error: variable or field 'copyInput' declared void
182:12: error: 'songs' was not declared in this scope
182:18: error: 'numSongs' was not declared in this scope
182:38: error: 'songName' was not declared in this scope
182:47: error: expected '}' before ';' token
183:11: error: expected constructor, destructor, or type conversion before '(' token
184:5: error: 'songs' does not name a type
185:5: error: 'songs' does not name a type
186:11: error: expected constructor, destructor, or type conversion before '(' token
188:1: error: expected declaration before '}' token

closed account (1Ck93TCk)
Wait. I'm not getting any of those errors on my end. What am I missing?
Last edited on
So we have an impasse :(
closed account (1Ck93TCk)
That's super helpful.
Take a look at this,

1
2
3
4
5
6
7
8
9
void copyInput
{
    strcpy(songs[numSongs].songName, songName);
    strcpy(songs[numSongs].artist, artist);
    songs[numSongs].min = min;
    songs[numSongs].sec = sec;
    strcpy(songs[numSongs].album, album);

}


I see that you kind of define the function copyInput. I say "kind of define", because I do not see the number of parameters the function takes. Even, if the function copyInput does not take any parameters, it should be void copyInput()

Which it goes to my question that would answer the above issue, Where is the function declaration for void copyInput ?
That's super helpful.
So you can't program, can't fix simple errors, can't post, can't cooperate in your own interests, can't ask for anything beyond making snotty-nosed self-entitled POS backchat.

You're doomed to being a passive aggressive life failure where you think the world owes you a living.
closed account (1Ck93TCk)
I realize my copyInput function doesn't work. It's not finished, what you see is just a rough idea, I'm not sure how it's really going to look. I was going to work on that once I had this current problem fixed. At this point I'm commenting out that section when I test the program, so that shouldn't be the cause of my problem.

Last edited on
closed account (1Ck93TCk)
againtry,

I'm not trying to be obtuse. I just don't understand why you're getting those errors and I'm not. How can I fix errors that I'm not seeing?

Maybe if you're going to browse and post on the beginner forum then try to keep in mind that we're BEGINNERS. People like you are the reason that people are afraid to come here and ask for help.

Last edited on
> At this point I'm commenting out that section when I test the program
> I just don't understand why you're getting those errors and I'm not
¿why did you post different code that your own?
post the exact code that's giving you problems

provide the user input too
Last edited on
closed account (1Ck93TCk)
The exact problem that I'm asking for help with is in the above function called inputNew. The copy here is exactly the same as the copy that I'm testing. I only posted the whole program because I've been chastised in the past for leaving part of the program out. But in this case, it seems like my actual problem is getting lost because people are focusing on the rest of the program (which isn't finished).
The only difference between what I'm testing and what I've posted is that I have commented out the one function - and it's not the function that againtry was getting errors for.
This is the exact code that's giving me problems.
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
void inputNew(songType songs[], int &numSongs)
{
    char songName[100];
    char artist[100];
    int min;
    int sec;
    char album[100];

    clearScreen();
    cout << "Enter the name of the song: ";
    cin.getline(songName, 100);
    cout << "Enter the name of the Artist: ";
    cin.getline(artist, 100);
    cout << "Enter the minutes: ";
    cin >> min;
    cout << "Enter the seconds: ";
    cin >> sec;
    cout << "Enter the album name: ";
    cin.getline(album, 100);
    cin.ignore(100, '\n');

    cout << "You entered: " << endl;
    cout << "Song: " << songName << endl;
    cout << "Artist: " << artist << endl;
    cout << "Time: " << min << ":" << sec << endl;
    cout << "Album: " << album << endl;

}


I'm not actually getting any errors. I'm just having trouble with this function's behavior. When it gets to the last cin statement, it doesn't run the test statements below, it just skips back to the menu.

As for user input, I've just been typing in things like "songname" and "artistname" just as filler.

Any ideas?

Thanks!

Last edited on
Hello jmb,

I am not seeing any problem here. The function is doing exactly what you told it to do.

Two changes I did make was to move line 20 up to line 18 and just before the closing brace I added std::cout << std::endl; // <--- Used as a break point for testing. .

What you need to do is follow the program from the beginning.

First you clear the screen and then display the menu.

After selecting your choice you process the choice and call "inputNew" and after defining the variables you clear the screen again.

The rest of the function inputs what you need and prints it out. Returning to the switch and the "break" statement which returns to "main" and repeats the loop.
Calling the menu function which clears the screen.

Which means the the input you just did has scrolled off the screen looking like nothing happened.

The line I added to the bottom of the "inputNew" function will allow you to set a break point and stop and see what the function did before you continue.

What you have missed in the "inputNew" function is to either enter directly into the array or copy your variables into the array. You have passed the array and size used to the function, but never use them.

Andy

Edit: typos
Last edited on
I'm not trying to be obtuse.

I agree. You are just being your normal passive agressive self-entitled uncooperative POS self.

I just don't understand why you're getting those errors and I'm not.
Of course you don't. You made that clear and decided not to cooperate and now you are changing the story to save face. The actions of a very weak but destructive person.

How can I fix errors that I'm not seeing?
Exactly, because you are blind and uncooperative. You could have pressed the button and run your code in the cppshell the same as everybody can, including me. But you decided to argue the point with your POS loser rubbish.

Maybe if you're going to browse and post on the beginner forum then try to keep in mind that we're BEGINNERS.
Stamp your foot as much as you like. Being a "BEGINNER' doesn't give you special rights when common courtesy and cooperation is all it takes. You are totally responsible for the direction you've taken. Live with it, princess!

People like you are the reason that people are afraid to come here and ask for help.
And cretins like you will go through life being destructive losers. Fuck you!
closed account (1Ck93TCk)
It's funny how you know so much about me when this is our first interaction. I'm done with you. Have a nice life.
It's anything but funny.

All I know about you is your demonstrated behavior and a comparison with cooperative, intelligent and decent people.

I'd wish you a nice life too but the way it looks so far you are doomed to continued misery because of your self important attitude.

Your colleagues elsewhere doing the same project got voluminous help while you still moan and self pity. Go figure - that might be the start of your new life as a human.
jesus christ. can we stop with the fucking abuse and get back to programming?
MYOFB nobody's stopping you.
Apparently not.
Namby Pamby the tinman strikes again. You're half the problem.

Hope that helps
Just as I thought.
Pages: 12