Help for beginner

Sorry my English is bad.Im beginner in programming with c++ and have some ?s
1.
Write a program with a function main () and selecting a menu of functions:
Generate a programming-random number generator data for lottery ticket / max 100 / with six-digit numbers and store them in an array
-Overwrite generated a new array and sort this array in ascending order and display output
-Counting and display output and numbers of all "happy" six digit lottery tickets /these numbers which sum of the first 3 digits is equal to the last three/
-Save in the array and display output sequence numbers of downloaded "lucky" lottery tickets

I only have the generator
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <stdio.h>
#include <cstdlib>
#include <ctime>
#include <iostream>
using namespace std;

int main()
{
srand((unsigned)time(0));
    int numbers;
    int i;
    for(i=0; i<100; i++){
        numbers = (rand()%100000)+100000;
        cout << numbers << endl;}
      return 0;
}


but how to store these numbers in array and how to find the numbers wich first 3 dights=last 3???

2.
Compile program functions for:
-Enter of a keyboard and a file into an array (by adding) data to 30 girls in the competition "Miss World"
number, name, surname, date of birth, physical data, state and display the current contents of the array on the screen
-display output data for a girl by entered from the keyboard a number and surname / by request
a new report /
-Displays data for the youngest girl in the competition and the number of girls under the age of 20 years
Home-function main () menu selection functions and check the status of the data using the Global
variables or functions with transmission parameters, optional

I have a code but how to display youngest girl and how to display data for 1 girl by entered number and family??

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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#include <iostream>
using namespace std;
#include <stdio>
#include <conio.h>
#include <cstdlib>
#include <string>
#define N 30 //max girls

typedef struct
{
   char number[10];
   char name[10];
   char family[10];
   int age;
   float heigth;
   float weight;
   char country[3];
} girl;

girl d[N];
int top=0;
float height;
float weight;

void load();
void save();


void input()
{
   int i, n;
   do
   {
       cout<<"\n Whats the number of girls?: ";
       cin>>n;
   }
   while (n<1||n>N);
   fflush(stdin);
   for(i=top;i<n;i++)
   {
       cout<<"\n Number: ";
       cin>>d[i].number;
       cout<<"\n Name: ";
       cin>>d[i].name;
       cout<<"\n Familiy: ";
       cin>>d[i].family;
       cout<<"\n Age: ";
       cin>>d[i].age;
       cout<<"\n Height: ";
       cin>>d[i].height;
       cout<<"\n weight: ";
       cin>>d[i].weight;
       cout<<"\n country: ";
       cin>>d[i].country;
   }
   top+=n;
}


void disp(int i) //Display data for 1 girl
{
   cout<<"\n "<<d[i].nomer<<"\t"<<d[i].ime<<"\t"<<d[i].family<<"\t"<<d[i].age<<"\t"<<d[i].visochina<<"\t"
       <<d[i].teglo<<"\t"<<d[i].country<<endl;
}

void list() //List of girls
{
   int i;
   cout<<"\n List of Girls\n";
   for(i=0;i<top;i++)
   disp(i);
}

void teen()
{
   int i;

   cout<<"\n Girls under 20\n";
   for(i=0;i<top;i++)
   {
       d[i].age*=1;
       if(d[i].age<20)
           disp(i);
   }
}


void load() //file
{
   FILE *fp;
}

int menu()
{
   int ch;
   cout<<"\n_______________MENU_____________________";
   cout<<"\n 1. Input number of girls";
   cout<<"\n 2. Display list of all girls";
   cout<<"\n 3. Display girls under 20";
   cout<<"\n 4. Exit";

   do
   {
       cout<<"\n Choice: ";
       cin>>ch;
   }
   while(ch<1||ch>4);
       return(ch);
}

int main()
{
   int i;
   cout<<"\n Loading file\n";
   load();
   do
   {
       i=menu();
       switch(i)
       {
       case 1: input();break;
       case 2: list();break;
       case 3: teen();break;

 

       }

   }
           while(i!=4);
return 0;
}

Last edited on
Anyone?
Topic archived. No new replies allowed.