Dev - C++ - Árbol genealógico en C++

 
Vista:

Árbol genealógico en C++

Publicado por Anonimo (1 intervención) el 08/04/2019 21:04:38
//Necesitamos hacer que dosarreglos que tengan el menor número de 3 , el primer arreglo agarrar sus primeros 3 valores y del segundo arreglo agarrar los ultimos 3 y con esos valores armar otro con los ultimos 3 valores del primer arreglo y del segundo arreglo agarrar los primeros 3 valores y que se almacene en otro arreglo, hacer esto hasta que los arreglos productos no tengan ningun 3


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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#include <iostream>
#include<stdlib.h>
#include<time.h>
#include<conio.h>
using namespace std;
int main (){
 
	srand(time(NULL));
	int arreglo[5];		cout<<"Arreglo 1"<<endl;
	int i, aux=0;
 
	for(i=0;i<=5;i++){
		int w=rand()%4;
		arreglo[i] = w;
		if(w==3){
		aux=aux+1;
		}
		cout<< arreglo[i]<<" ";
	}
	cout<<endl;
	cout<<"Numeros 3 hay: "<< aux;
	cout<<endl;
/////////////////////////////////////	
	int arreglo2[5];   cout<<"Arreglo 2"<<endl;
	int aux2=0;
 
	for(i=0;i<=5;i++){
		int e=rand()%4;
		arreglo2[i] = e;
		if(e==3){
		aux2=aux2+1;
		}
		cout<< arreglo2[i]<<" ";
	}
	cout<<endl;
	cout<<"Numeros 3 hay: "<< aux2;
	cout<<endl;
/////////////////////////////////////
	int arreglo3[5];   cout<<"Arreglo 3"<<endl;
	int aux3=0;
 
	for(i=0;i<=5;i++){
		int r=rand()%4;
		arreglo3[i] = r;
		if(r==3){
		aux3=aux3+1;
		}
		cout<< arreglo3[i]<<" ";
	}
	cout<<endl;
	cout<<"Numeros 3 hay: "<< aux3;
	cout<<endl;
/////////////////////////////////////
	int arreglo4[5];   cout<<"Arreglo 4"<<endl;
	int aux4=0;
 
	for(i=0;i<=5;i++){
		int t=rand()%4;
		arreglo4[i] = t;
		if(t==3){
		aux4=aux4+1;
		}
		cout<< arreglo4[i]<<" ";
	}
	cout<<endl;
	cout<<"Numeros 3 hay: "<< aux4;
	cout<<endl;
/////////////////////////////////////
	int arreglo5[5];   cout<<"Arreglo 5"<<endl;
	int aux5=0;
 
	for(i=0;i<=5;i++){
		int a=rand()%4;
		arreglo5[i] = a;
		if(a==3){
		aux5=aux5+1;
		}
		cout<< arreglo5[i]<<" ";
	}
	cout<<endl;
	cout<<"Numeros 3 hay: "<< aux5;
	cout<<endl;
/////////////////////////////////////
	int arreglo6[5];   cout<<"Arreglo 6"<<endl;
	int aux6=0;
 
	for(i=0;i<=5;i++){
		int s=rand()%4;
		arreglo6[i] = s;
		if(s==3){
		aux6=aux6+1;
		}
		cout<< arreglo6[i]<<" ";
	}
	cout<<endl;
	cout<<"Numeros 3 hay: "<< aux6;
	cout<<endl;
/////////////////////////////////////
	int arreglo7[5];   cout<<"Arreglo 7"<<endl;
	int aux7=0;
 
	for(i=0;i<=5;i++){
		int d=rand()%4;
		arreglo7[i] = d;
		if(d==3){
		aux7=aux7+1;
		}
		cout<< arreglo7[i]<<" ";
	}
	cout<<endl;
	cout<<"Numeros 3 hay: "<< aux7;
	cout<<endl;
/////////////////////////////////////
	int arreglo8[5];   cout<<"Arreglo 8"<<endl;
	int aux8=0;
 
	for(i=0;i<=5;i++){
		int f=rand()%4;
		arreglo8[i] = f;
		if(f==3){
		aux8=aux8+1;
		}
		cout<< arreglo8[i]<<" ";
	}
	cout<<endl;
	cout<<"Numeros 3 hay: "<< aux8;
	cout<<endl;
/////////////////////////////////////
	int arreglo9[5];   cout<<"Arreglo 9"<<endl;
	int aux9=0;
 
	for(i=0;i<=5;i++){
		int z=rand()%4;
		arreglo9[i] = z;
		if(z==3){
		aux9=aux9+1;
		}
		cout<< arreglo9[i]<<" ";
	}
	cout<<endl;
	cout<<"Numeros 3 hay: "<< aux9;
	cout<<endl;
/////////////////////////////////////
	int arreglo10[5];   cout<<"Arreglo 10"<<endl;
	int aux10=0;
 
	for(i=0;i<=5;i++){
		int x=rand()%4;
		arreglo10[i] = x;
		if(x==3){
		aux10=aux10+1;
		}
		cout<< arreglo10[i]<<" ";
	}
	cout<<endl;
	cout<<"Numeros 3 hay: "<< aux10;
	cout<<endl;
}
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