La descarga está en progreso. Por favor, espere

La descarga está en progreso. Por favor, espere

Variables Automáticas y Apuntadores

Presentaciones similares


Presentación del tema: "Variables Automáticas y Apuntadores"— Transcripción de la presentación:

1 Variables Automáticas y Apuntadores
Lenguaje Variables Automáticas y Apuntadores

2 Variables Automáticas y Apuntadores
Las variables automáticas se crean en tiempo de compilación y se destruyen al terminar la ejecución del módulo donde fueron declaradas. Aunque no es estrictamente necesario, se pueden manejar las variables automáticas por medio de apuntadores. 

3 #include <iostream.h> #include <conio.h>
void main() { int automatica ; int *apunt ; automatica = 100 ; apunt = &automatica ; clrscr(); cout << "VALOR=" << automatica << " \n"; *apunt= 200 ; getch(); }

4 Instrucciones Gotoxy – Printf – Scanf - Clrscr
Instrucción GOTOXY. (col-fil). Permite ubicar las coordenadas dentro de la pantalla. Formato. Gotoxy(30,5); Instrucción Printf. Presenta mensajes o contenidos de variables en el lenguaje C. Formato. Printf(“hola”); Instrucción Scanf . Recepta un dato a una variable a ser utilizada en el programa. Formato scanf (“%d”,&op); Instrucción Clrscr. Borra pantalla Formato (clear screen)

5 Comentarios y función printf

6 La función scanf

7 LEER 2 NUMEROS DIFERENTES, SUMARLOS Y MOSTRAR EL RESULTADO
 // ESTA ES EL AREA DESTINADA A INCLUIR LOS PROCEDIMIENTOS PREDEFINIDOS #include <stdio.h> #include <conio.h> // Para ingresar valores esta la palabra reservada scanf() // Para mostrar valores esta la palabra reservada printf() // ESTA ES EL AREA DESTINADA PARA LAS VARIABLES Y CONSTANTES // int numerito, numerote; // UN AREA DE MANEJO PRINCIPAL DE LOS PROCEDIMIENTOS Y/O FUNCIONES // DEL PROGRAMA. int main () { // PROCEDER A MOSTRAR MENSAJES AL USUARIO Y ENUNCIAR LA PALABRA RESERVADA // PARA ACEPTAR LOS 2 NUMEROS: LEO O ACEPTO LOS NUMEROS CON LA PALABRA int numero1; int numero2; int resultado; // SECCION DE ENTRADA DE DATOS clrscr; printf("INGRESE EL NUMERO 1: ");scanf("%d",&numero1); printf("INGRESE EL NUMERO 2: ");scanf("%d",&numero2); // SECCION DE PROCESAMIENTO resultado = numero1 + numero2; // SECCION DE SALIDA DE DATOS printf("LA SUMA DE LOS NUMEROS INGRESADOS ES> %d", resultado); getch(); }

8 GENERAR NUMEROS DEL 1 AL 10, SUMARLOS Y MOSTRAR EL RESULTADO
// ESTA ES EL AREA DESTINADA A INCLUIR LOS PROCEDIMIENTOS PREDEFINIDOS #include <stdio.h> #include <conio.h> // Para ingresar valores esta la palabra reservada scanf() // Para mostrar valores esta la palabra reservada printf() // ESTA ES EL AREA DESTINADA PARA LAS VARIABLES Y CONSTANTES // int numerito, numerote; // UN AREA DE MANEJO PRINCIPAL DE LOS PROCEDIMIENTOS Y/O FUNCIONES // DEL PROGRAMA. int main () { // PROCEDER A MOSTRAR MENSAJES AL USUARIO Y ENUNCIAR LA PALABRA RESERVADA // PARA ACEPTAR LOS 2 NUMEROS: LEO O ACEPTO LOS NUMEROS CON LA PALABRA int i; int suma; // SECCION ENCERAR LAS VARIABLES clrscr; i = 0; suma = 0; // SECCION DE PROCESAMIENTO for (i = 0; i <= 10; i++)

9

10 Define


Descargar ppt "Variables Automáticas y Apuntadores"

Presentaciones similares


Anuncios Google