Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Proyecto 1
// Creado por Salvador Eliot Hilares Barrios // // 10/10/2018 // // -----------------// #include<iostream> #include<iomanip> #include<cmath> using namespace std; void Uni (int U[10][10]); void PrimerLle(int U[10][10] , int Coo[][2] , int nfi , int nco ); void UltimoLle(int U[10][10] , int Coo[][2] , int nfi , int nco ); int determinante(int x1,int y1, int x2, int y2); void Giros (int matrix[][2] , int puntos); void TusCoo(int lle[][2] , int nfi ); void Imp (int U[10][10] , int nfi , int nco); int main(){ // Se necesita la cantidad de veces que se debe mover el dron // // Datos del problema // // Definimos el tamaño de nuestro universo // int Un[10][10]; int Mov = 0; int max ; cout<<"Ingrese la cantidad de veces que quiera que se mueva su dron: "<<endl; cout<<endl; cin>>Mov; int Vec[Mov][2]; cout<<endl; // Llamando A las Funciones // Uni(Un); // Aqui definimos nuestro universo cout<<"Ingrese sus coordenadas por donde se va a mover el dron: "<<endl; cout<<endl; TusCoo (Vec , Mov ); // Genera La Matriz del usuario // Calcula el maximo numero de la fila // for (int i=0; i<Mov ; i++){ if (Vec[i][0] > max){ max = Vec[i][0]; } } //EncontrandoElMaximo(Vec , Mov , max); // El maximo de filas // cout<<max<<endl; // // Cambiando los valores del usuario en mi matriz universo // if (Mov== 0){ Imp(Un , 10 , 10); } else { PrimerLle(Un, Vec , max , 10); //SegundoLle(Un , Vec ); Imp(Un , 10 , 10); Giros(Vec , Mov); } } void PrimerLle(int U[10][10] , int Coo[][2] , int nfi , int nco ){ //Llenara la matriz universal de izquierda a derecha con los valores predeterminados del for anidado // // Para el llenado usaremos los vectores del usuario // for (int i=0 ; i <= nfi ; i++){ for (int j=0 ; j <= nco ; j++){ for (int k=0 ; k<=nfi ; k++){ //Vamos a poner una condicional if // if ( k == Coo[i][0] && j == Coo[i][1]) U[k][j] = 1 ; } } } } void UltimoLle(int U[10][10] , int Coo[][2] , int nfi , int nco){ // Aqui haremos el ultimo llenado } int determinante(int x1,int y1, int x2, int y2){ return x1*y2-y1*x2; } void Giros(int matrix[][2] , int puntos ){ int izq = 0 , der = 0 ; for(int i=0; i <puntos-2; i++){ int x1=matrix[i+1][0]-matrix[i][0]; int y1=matrix[i+1][1]-matrix[i][1]; int x2=matrix[i+2][0]-matrix[i+1][0]; int y2=matrix[i+2][1]-matrix[i+1][1]; if(determinante(x1,y1,x2,y2)>0) { izq++; } else if(determinante(x1,y1,x2,y2)<0){ der++; } } cout<<"Los giros a la izquierda son: "<<izq<<endl; cout<<"Los giros a la derecha son: "<<der; } void Uni(int U[10][10]){ //Aqui definimos nuestro universo // for (int i=0 ; i<10 ; i++){ for (int j=0 ; j<10 ;j++){ U[i][j] = 0; } } } void TusCoo(int lle[][2] , int nfi ){ // Por razonamiento, se sabe que las movidas son definidas por el usuario // // Por lo tanto necesitamos una matriz donde este la información del usuario // for (int i=0 ; i<nfi ; i++){ for (int j=0 ; j<2 ; j++){ cin>>lle[i][j]; } } } void Imp(int U[10][10] , int nfi , int nco) { // Se Imprimira la matriz resultante (el universo cambiado por los vectores del usuario ) // for (int i=0 ; i<nfi ; i++){ for (int j=0 ; j<nco ; j++){ cout<<U[i][j]; } cout<<"\n"; } }
run
|
edit
|
history
|
help
0
TupleCPP
Summation Of Primes
Rrrrrrrr
Test 7(2020)
FindKthElementDivideConquer
Ploshtina na krug
override
Collatz Conjecture
Kth Smallest Element (with extra space)
find-missing-number-arithmetic-progression