Programa Suma Simple C++

martes, 31 de julio de 2012

Como Seria En Borland Pascal:

program PRIMERO;
uses wincrt;
var
A,B:integer;
begin
 A:=7;
 B:=8;
 writeln('La Suma De ', A ,' + ',B,' es: ', (A+B));
End.
-------------------------------------------------------------------------------------------------------
 Como se Veria Traducido a Borland C++
//program primero
 #include <iostream.h>
 #include <conio.h>
 //var
int A,B;
 int main ()
   {
     A=7;
     B=8;
     cout<<"LA SUMA DE "<<A<<" + "<<B<<" ES:"<<(A+B)<<endl;
 getch();
 return 0;
   }

examen rompe coco

viernes, 20 de julio de 2012

program menucito;
uses wincrt;
var
n,suma,no,resultado,i,op,j:integer;
promedio:real;
begin
{Flores Richarth Informatica II matutino v-24197236}
writeln('***  Menu  ***');
writeln('1.- Sistema de numeraciòn');
writeln('2.- Calculo de notas');
readln(op);
if op=1 then
begin
for i:=7 to 100 do
if ((i mod 7)=0)  and (i<>14) and (i<>28) and (i<>42) and (i<>56) and
(i<>70) and (i<>84 ) and (i<>98) or (i=2)    then
writeln(i);
end;
if op=2 then

begin
 writeln('Cuantas Notas Son?');
 readln(n);

  for j:=1 to n do
   begin
  writeln('Introduzca Nota ',j);
  readln(no);
  suma:=suma+no;
  promedio:=suma/n;

  promedio:=(suma*n)/100;

      end ;
   writeln('su promedio es  ', promedio:2:0);
   if  promedio < 10 then
   writeln('Reprovado')
   else
   if promedio >10 then
write('Aprovado');
      end;
end.

Repit until si o no

jueves, 19 de julio de 2012

Program Repita_until1;
Uses WinCrt;
Var resp:char;
Begin
ClrScr;
REPEAT
Writeln ('***Desea continuar el programa , S/N***');
Readln (resp);
UNTIL resp='N';
End.

Repit Until Basico

Program Repita_until3;
Uses WinCrt;
Var n, x:integer;
Begin
n:=1;
Writeln ('***Hasta que número***');
Readln (x);
REPEAT
Writeln (n);
n:=n+1;
UNTIL n>x;
End.

Promedios

Program Repita_until4;
Uses WinCrt;
Var nombre:string;
resp:char;
one,two,prome,suma,total:real;
j:integer;
Begin
REPEAT
j:=j+1;
Writeln ('***Cálculo de notas***');
Writeln ('');
Writeln ('***Ingrese nombre del alumno***');
Readln (nombre);
Writeln ('');
Writeln ('***Ingrese nota 1***');
Readln (one);
Writeln ('');
Writeln ('***Ingrese nota 2***');
Readln (two);
Writeln ('');
prome:=(one+two)/2;
Writeln ('***El promedio es: ***', prome:5:3);
Writeln ('');
suma:=suma+prome;
Writeln ('***Desea ingresar nota de otro alumno, S/N***');
Readln (resp);
UNTIL resp='N';
Writeln ('***La suma de promedios es: ***', suma:5:3);
total:=suma/j;
Writeln ('***El promedio general es: ***', total:5:3);
End.

Cases

Program Cases_2;
Uses WinCrt;
Var i,op,n,j:integer;
nombre:string;
resp:char;
precio,totalventas,suma:real;
Begin
Writeln ('***MENÚ CASES II***');
Writeln ('');
Writeln ('***1-Cálculo de números***');
Writeln ('***2-Cálculo de números de 1 a 100, pares, divisibles entre 5***');
Writeln ('***3-Cálculo de precios de productos seleccionados***');
Writeln ('');
Writeln ('***Su opción entre 1 a 3 es***');
Readln (op);
ClrScr;




Case op of
1:Begin
Writeln ('***SUBMENÚ Cálculo de números***');
Writeln ('');
Writeln ('***1-Números pares***');
Writeln ('***2-Números impares***');
Writeln ('***3-Números primos***');
Writeln ('');
Writeln ('***Su opción entre 1 a 3 es***');
Readln (op);
ClrScr;




If op=1 then
Begin
Writeln ('***Números pares***');
Writeln ('');
For i:=1 to 30 do
If ((i mod 2)=0) then
Writeln ('***WeeehWilly***', i);
End;




If op=2 then
Begin
Writeln ('***Números impares***');
Writeln ('');
For i:=1 to 30 do
If ((i mod 2)=1) then
Writeln ('***WeeehWilly***', i);
End;




If op=3 then
Begin
Writeln ('***Números primos***');
Writeln ('');
For i:=1 to 30 do
If ((i mod 2)=1) and (i<>9) and (i<>15) and (i<>21) and (i<>25) and (i<>27) or (i=2) then
Writeln ('***WeeehWilly***', i);
End;




If (op<>1) and (op<>2) and (op<>3) then
Writeln ('***Opción no válida***');
End;




2:Begin
Writeln ('***Números del 1 al 100, pares, divisibles entre 5***');
Writeln ('');
For i:=1 to 100 do
If ((i mod 5)=0) and ((i mod 2)=0) then
Writeln ('***WeeehWilly***', i);
End;




3:Begin
Writeln ('***Cálculo de precios de productos seleccionados***');
Writeln ('');
REPEAT
j:=j+1;
Writeln ('***Ingrese nombre del producto***');
Readln (nombre);
Writeln ('');
Writeln ('***Ingrese precio del producto***');
Readln (precio);
Writeln ('');
Writeln ('***El precio de producto es: ***', precio:5:3);
Writeln ('');
suma:=suma+precio;
Writeln ('***Desea obtener otro producto, S/N***');
Readln (resp);
UNTIL resp='N';
Writeln ('***La cantidad de artículos es: ***', j);
Writeln ('***El precio total es: ***', suma:5:3);
totalventas:=suma/j;
Writeln ('***El promedio de las ventas es de: ***', totalventas:5:3);
End;
End;




If (op<>1) and (op<>2) and (op<>3) then
Writeln ('***Opción no válida***');
End.

Impares - Pares - Primos Con For

PROGRAM lol;
        USES WINCRT;
        VAR i,op:Integer;
BEGIN
     Writeln('**Menu***');
     Writeln('');
     Writeln('Pulse 1 para los Numero Pares Ascendente');
     Writeln('Pulse 2 para los Numero Impares Ascendente');
     Writeln('Pulse 3 para los Numero Primos Ascendente');
     Writeln('Pulse 4 para los Numero Pares Descendente');
     Writeln('Pulse 5 para los Numero Impares Descendente');
     Writeln('Pulse 6 para los Numero Primos Descendente');
     Readln(op);
     If op= 1 then
     Begin
          ClrScr;
          {LES REGALE 5PTS}
          Writeln('Numero Pares Ascendente');
          FOR i:=1 TO 10 DO
          IF (i mod 2)=0 then
          Writeln(i);
     End;
     If op= 2 then
     Begin
          ClrScr;
          {OK YA AQUI LLEVAN 10PTS}
          Writeln('Numero Impares Ascendente');
          FOR i:=1 TO 10 DO
          IF (i mod 2)=1 then
          Writeln(i);
     End;
     If op= 3 then
     Begin
          ClrScr;
          Writeln('Numero Primos Ascendente');
          {EXTREMADAMENTE SENCILLO}
          FOR i:=1 TO 10 DO
          IF ((i mod 2)=1) and (i<>9) or (i=2) THEN
          Writeln(i);;
     End;
     If op= 4 then
     Begin
          ClrScr;
          Writeln('Numero Pares Descendente');
          {NUEVO}
          FOR i:=10 DOWNTO 1 DO
          IF (i mod 2)=0 then
          Writeln(i);
     End;
     If op= 5 then
     Begin
          ClrScr;
          Writeln('Numero Impares Descendente');
          {NUEVO}
          FOR i:=10 DOWNTO 1 DO
          IF (i mod 2)=1 then
          Writeln(i);
     End;
      If op= 6 then
     Begin
          ClrScr;
          Writeln('Numero Primos Descendente');
          {NUEVO}
          FOR i:=10 DOWNTO 1 DO
          IF ((i mod 2)=1) and (i<>9) or (i=2) THEN
          Writeln(i);;
     End;
END.

 
Richarth Flores © 2012 | Traduzido Por: Template Para Blogspot