Dev - C++ - Reporteros y Deportes en C++

 
Vista:
sin imagen de perfil

Reporteros y Deportes en C++

Publicado por monica (1 intervención) el 16/03/2022 02:05:00
Buenas tardes necesito resolver este codigo, pero solo la tercera funcion del Case:
tengo el codigo listo solo me falta la tercer funcion que no supe como sacar por pantalla el resultado.
La tercera funcion consiste en escribir el codigo del deporte y que aparezca por pantalla los reporteros interesados en el.
La estructura "void Bysport(int sp,struct sport deporte[], struct persona reporter[])" esta vacia y es donde ira el proceso.
Agradeceria mucho su ayuda.

/*Al entrar a esta opcion del menú, deben declararse dos vectores de estructuras: un primer vector con la información de los reporteros (periodistas) deportivos que estan incritos
en el colegio superior de comunicaciones del pais: el otro verctor, con la información de los deportes a los que se les hace cobertura.*/

#include<iostream>
#include<conio.h>
#include<stdio.h>
#include<iomanip>
#include <windows.h>
using namespace std;


void Lreporter (int nr,struct persona reporter[]);
void Ldeporte (int nd,struct sport deporte[]);
void Bysport (int sp,struct sport[], struct reporter[]);
void menu();

void gotoxy (int x,int y){
HANDLE hcon;
hcon=GetStdHandle (STD_OUTPUT_HANDLE);
COORD dwPos;
dwPos.X = x;
dwPos.Y = y;
SetConsoleCursorPosition (hcon,dwPos);
}//cierre gotoxy

struct persona{
string nombre; //nombre del periodista
int fecnac; //Fecha de nacimiento en formato AAAAMMDD/
string sexo; //Sexo (f-m)
string ciudad; //Donde reside el reportero
int nd; //numero de deportes que le interesan
int codigo[10]; //Codigo de los deportes que le interesan

};//cierre de estruct persona


struct sport{
int codigo; //codigo del deporte
string auxi; //Si el deporte tiene o no tiene auxilio
string nombre; //nombre del deporte
int numtrans[10]; //transmision en los ultimos 10 campeonatos


};// cierre estructura de deporte


persona reporter[100]={
{"Esteban", 19631023, "M", "Medellin", 8, {106,102,110,101,103,109,104}},
{"Fernanda", 19601221, "F", "Medellin", 1, {109}},
{"Cesar", 19610430, "M", "Armenia", 8, {113,105, 115,112,110,102,104,108}},
{"Eyner", 19600202, "M", "Bogota", 2, {103,113}},
{"Luisa", 19941210, "F", "Medellin", 7, {113, 109,110,105, 109,106,125}},
{"Jacob", 19650925, "M", "Armenia", 2, {108,105}},
{"Nicolas", 19620520, "M", "Pereira", 1, {109}},
{"Maria", 19630306, "F", "Cali", 7, {109,103,104,106,113,105, 101}},
{"Yair", 19620903, "M", "Cali", 1, {109}},
{"Vanesa", 19651001, "F", "Medellin", 4, {108,107, 101,105}},
{"Francisco", 19631025, "M", "Cali", 6, {109,105, 102,110,112,101}},
{"Camilo", 19610801, "M", "Armenia", 5, {110,104,101,109,114}},
{"kevin", 19620602, "M", "Cali", 4, {108,114,101,110}},
{"Valeria", 19630230, "F", "Pereira", 3, {111,107,102}},
{"Sebastian", 19630407, "M", "Cali", 5, {101,112, 104,115, 111}},
{"sofia", 19610406, "F", "Bogota", 8, {11,115,105, 101, 104,103,108, 110}},
{"Santiago", 19601209, "M", "Cali", 2, {106,114}},
{"Enrique", 19610927, "M", "Cali", 1, {107}},
{"Jose", 19620530, "M", "Armenia", 8, {105,115,103, 101,110,104,114,106}},
{"David", 19610922, "M", "Medellin", 5, {106,115, 102,101,110}},
{"Ana", 19611229, "F", "Armenia", 5, {110,113,104,111,103}},
{"Joshua", 19600901, "M", "Armenia", 4, {213, 109,106, 112}},
{"Felipe", 19600614, "M", "Bogota", 5, {113, 112,108, 104,114}},
{"Janna", 19601003, "F", "Medellin", 2, {104,102}},
{"Alejandra", 19640929, "F", "Cali", 5, {108,101,103,105,113}},
{"Daniela", 19611005, "F", "Bogota", 7, {102,112,105,104,107,106,115}},
{"Andres", 19630821, "M", "Cali", 1, {114}},
{"Juana", 19630817, "F", "Pereira", 6, {104,103,107,115,114,102}},
{"Zaida", 19651203, "F", "Bogota", 7, {113,102,112,103,101,107,114}},
{"Jeisson", 19630908, "M", "Medellin", 8, {113,108, 101,115,104,111,114,102}}
};//cierre datos reporter

sport deporte[100]={
{101, "S", "Futbol", {18,20,1,18,15,10,10,12,8,13}},
{102, "N", "Beisbol", {6,18,17,5,19,1,20,17,12,4}},
{103, "S", "Tenis", {11,6,15,7,2,18,2,4,17,7}},
{104, "S", "Natacion", {10,18,14,13,1,17,6,7,11,15}},
{105, "N", "Gimnasia", {14,9,2,7,8,6,4,6,6,15}},
{106, "S", "Salto", {7,2,1,16,2,6,18,15,12,16}},
{107, "S", "Bmx", {8,13,2,9,3,18,17,1,18,7}},
{108, "N", "Pista", {4,5,1,19,2,10,15,19,16,3}},
{109, "S", "Ruta", {12,19,14,12,11,4,18,7,14,19}},
{110, "S", "Voleybol", {10,4,17,5,4,3,9,17,14,10}},
{111, "N", "Basketbol", {2,19,19,1,19,5,8,3,12,12}},
{112, "S", "Karate", {2,6,19,7,12,11,15,3,8,10}},
{113, "S", "Arco", {4,9,15,12,15,6,11,14,12,7}},
{114, "S", "Clavado", {10,3,5,9,5,10,4,18,7,19}},
{115, "N", "Pingpong", {18,6,14,1,6,5,9,7,12,163}},
}; //cierre datos deporte

int nr = 30;
int nd = 15;
int sp;
main(){
menu();



}//cierre main

void Lreporter (int nr,struct persona reporter[]){//inicio void lista reporteros
int i,x,y;

for(int x=15; x<=110; x++)

{
gotoxy (x,4);
putchar ('°');
gotoxy (x,42);
putchar ('°');
}

for(int y=4; y<=41; y++)
{
gotoxy (15,y);
putchar ('°');
gotoxy (110,y);
putchar ('°');
}
gotoxy(1,6);cout<<"\t\t\t\tNOMBRE\t\tFECHA NACIMIENTO\tSEXO\t\tCIUDAD";
gotoxy(15,8);cout<<"°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°";
for(i=0;i<nr;i++){
gotoxy(32,10+i);cout<<reporter[i].nombre;
gotoxy(53,10+i);cout<<reporter[i].fecnac;
gotoxy(73,10+i);cout<<reporter[i].sexo;
gotoxy(88,10+i);cout<<reporter[i].ciudad;


}
cout<<endl<<endl;
}


void Ldeporte (int nd,struct sport deporte[]){
int i,x,y;

for(int x=14; x<=90; x++)

{
gotoxy (x,4);
putchar ('°');
gotoxy (x,29);
putchar ('°');
}

for(int y=4; y<=29; y++)
{
gotoxy (14,y);
putchar ('°');
gotoxy (90,y);
putchar ('°');
}

gotoxy(1,6);cout<<"\t\t\t\tCODIGO\t\tAUXILIO\t\tNOMBRE\n";
gotoxy(15,8);cout<<"°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°";

for(i=0;i<nd;i++){
gotoxy(33,11+i) ;cout<<deporte[i].codigo;
gotoxy(50,11+i);cout<<deporte[i].auxi;
gotoxy(64,11+i);cout<<deporte[i].nombre;

cout<<"\n\n\n\n\n\n\n\t\t";
}

cout<<"\n\n\n\n\n\n\n\n\t";
}

void Bysport(int sp,struct sport deporte[], struct persona reporter[]){



}







void menu(){
char op;


aa:
system("cls");
cout<<" MENU ";
cout<<"\n\t\t1.LISTA DE REPORTEROS.";
cout<<"\n\t\t2.LISTA DE DEPORTES.";
cout<<"\n\t\t3.SALIR.";
cout<<"\n\t\t4.Digite opcion. ";
cin>>op;


switch(op){
case '1':
system("cls");
Lreporter(nr,reporter);
cout<<"\n\n\n\n\n\n";
system("pause");
goto aa;
break;

case '2':
system("cls");
Ldeporte (nd,deporte);
system("pause");
goto aa;
break;


case '3':
system("cls");
Bysport (ns,sport[],reporter[]);
system("pause");
goto aa;
break;


case '4':
system("cls");
cout<<"\n\n\n\t\t\tGacias por visitarnos...Vuelve pronto ";
cout<<"\n\n\t\t\t\t || ||";
cout<<"\n\t\t\t\t || ||";
cout<<"\n\n\n\t\t\t\t ~----______----~";
cout<<"\n\t\t\t\t |____|";
cout<<"\n\n\n";
break;

default:
cout<<"\n\t\tERROR, VUELVE A INTENTAR.";
goto aa;
break;
}
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder