Sorry my English is bad.Im beginner in programing with c/c++ I have to write 2 codes and want some help
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 know only rand and srand but how to display these lucky/happy numbers and how to store 6dight numbers i array?
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
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 its wrong maybe and not completed I dont know how to display youngest girl and data for 1 girl also dont know how to work with files
#include <stdio>
#include <conio>
#include <cstdlib>
#include <string>
#include <iostream>
using namespace std;
#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;
}
And 2 codes msut be console applications and not object-oriented