C++ difficulty

Pages: 123
Hello I have a problem with this task at the moment:

A concert agency wants to manage their events to introduce a new computer system.
It is an event by means of a structure and all events are described
Events of the Agency as a linked list of events.
program
- A function void output (...)
which shows the data of an event on screen. The parameters can be suitably
be elected
- A function void output list (Event * start)
which, as all events of the list on the screen indicating the first element
This parameter is passed.
Test the functions using a suitable driver. Here, a list of
at least 4 concatenateded events are fixed (no need to read).
Other functions can be added as needed.
As a second project team to design the structure of event involved, you need to
Development first implement a simple prototype for this. as
Minimum requirement should be the prototype next to the pointer to the next element
- A description of the event
- The number of available seats
- The number of unsold seats
included.

I have problems at the moment in the beginning.


How should I define the function void output?

I hope somebody can help me.

1
2
3
4
void Output( /* Whatever parameters here*/ )
{
   // Code that shows data of event
}
1
2
3
4
5
6
7
void output(paramaters)
{
    for(from start to end of all parameters
   {
       std::cout << parameter[i];
   }
}
And do you also have an idea how I can do this:

- A function void output list (Event * start)
which, as all events of the list on the screen indicating the first element
This parameter is passed.

How should I define this function?

Sorry I have a little problem with this task , that `s why I am asking.

How can I show the first element as a parameter?
Last edited on
if event is a datatype, use this:

1
2
3
4
void output_list(Event *start)
{
    /*your code here*/
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>

using namespace std;

int main()
{
    void output(int a; int b; int c;)
{
    for(from start to end of all parameters
   {
       std::cout << parameter[i];
   }
   void output_list(Event *start)
{
    
    
}
}
}






void Output( /* Whatever parameters here*/ )
{
// Code that shows data of event
}



Can somebody tell me which kind of events I could take ?

That would me help a lot.


I'm assuming your Event class has a container member. Just output that container.
What do you mean by container member?

Which container should I output?
Well I don't know, I have no idea what the Event class looks like.
Is atleast my output now right?

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
#include <iostream>

using namespace std;

int main()
{
    void output(int a; int b; int c;)
{
    int a = theater;
    int b = seats;

    int c = unsolved seats;


    for(from start to end of all parameters
   {
       std::cout << parameter[i];
   }
   void output_list(Event *start)
{


}
}
}


Or when there is a mistake , how can I correct it?
This all wrong.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
int main()
{
    void output(int a; int b; int c;) //cant declare function in another function. Parameter list is separated by commas, no semi colons.
{
    int a = theater; //What is theatre? What is seats? None of these are defined as far as I can tell
    int b = seats;

    int c = unsolved seats;


    for(from start to end of all parameters   //This isn't actually anything. It's an example for you to base off of. People expect you to be able to write something yourself.
   {
       std::cout << parameter[i];
   }
   void output_list(Event *start)
{


}
}
}
Oh sorry. I have a little difficulty with programming and not so much idea like you people

How can I define seats and theatre?
closed account (zb0S216C)
ResidentBiscuit wrote:
//cant declare function in another function.

You're allowed to declare a function within a function, but you cannot give it a body. For instance:

1
2
3
4
5
6
7
8
9
int main( )
{
    int SomeFunction( );
}

int SomeFunction( )
{
    // Some code that I hope is worth typing.
}

I don't know if you knew that already, though :)

Wazzak
Can you show me how the code of the first function should be than I can try the other function myself?

Because I have problems in the beginning so that I cant really start with the task.

I would be really thankful for that.

You're allowed to declare a function within a function, but you cannot give it a body. For instance:

Are you sure? I've never heard this before, and it wouldn't make any sense.
I have nö idea that's why I am asking.


Can please someone help me ?
People have already told you how to get started, yet you haven't shown anything of your own yet.

After reading this, output_list() gets passed in the first node of a linked list. All you need to do is output the relevant information, move on to the next node, and repeat until you hit the last node.
closed account (zb0S216C)
ResidentBiscuit wrote:
"Are you sure? I've never heard this before, and it wouldn't make any sense."

I'm 100% sure. Declaring functions within another functions may seem like nonsense, but declaring function in such a way has its uses, however.

Wazzak
Well now you've sparked my curiosity. Why would this ever be useful? The only thing I can think of is to limit the scope of it, but why have a function that can only be used by one specific other function? And if you can't place the body of the function with it, where does that go?
Pages: 123