Quick actions

cmd+k|ctrl+k

Navigation

Languages

EdD2807

Snippet info

Language

Cpp

Visibility

public

Author

enriquecortez.111

Created

2016-07-28T13:23:52Z

Updated

2016-07-28T21:05:50Z

#include <iostream>
#include <cstdlib>//tiene la definicion de la funcion RAND (random)
using namespace std;

void funcionImpresion()
{
    cout << "\n\tEsta fucion solo muestra un texto ";
}   

int cuadradoNumero(int n1)
{
    return (n1 * n1);
}

void numeroPrimo(int n)
{
    bool primo = true;
    
    //FALTA CODIGO
    
    if(primo == true)
    {
        cout << "\n\nEl numero " << n << " es PRIMO";
    }
    else
    {
        cout << "\n\nEl numero " << n << " NO es PRIMO";
    }
}

void funcionArreglo()
{
    int arreglo[8] = {12, 10, 8, 6, 4, 2, 18, 20};
    
    //---------------------- IMPRIMEN LOS VALORES
    for(int i = 0; i < 8 ; i++)
    {
        cout << "\n Arreglo[ "<< i << " ]= " << arreglo[i];
    }//fin del ciclo for de mostrar datos
    
    
    //---------------------- RE ASIGNAN VALORES
    for(int i = 0; i < 8 ; i++)
    {
        //
        arreglo[i] = (1 + rand() % 35);
        
    }//fin del ciclo for de ingreso de datos
    
    cout << "\n\n Los valores han sido modificado";
    
    
    //---------------------- IMPRIMEN LOS VALORES
     for(int i = 0; i < 8 ; i++)
    {
        cout << "\n Arreglo[ "<< i << " ]= " << arreglo[i];
    }//fin del ciclo for de mostrar datos
    
} // fin de la funcion arreglo

int main() {
    
    /*
    //cout << "Hola a todos en Estructura de Datos!";
    
    //Llamada a la funcion 
    //funcionImpresion();
    //------------------------------------------------------
    */
    /*
    int a=5;
    
    int cuadrado = cuadradoNumero(a);
    
    cout << "\n\nEl cuadrado de " << a << " = " << cuadrado;
    cout << "\n\nEl cuadrado de " << a << " = " << cuadradoNumero(a);
    */
    
    //-----------------------------------------------------------
    //Crear una funcion que diga si un numero es primo o no
    //-----------------------------------------------------------
    
    funcionArreglo();
    
    return 0;
}

INFO