-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
181 lines (120 loc) · 4.1 KB
/
Program.cs
File metadata and controls
181 lines (120 loc) · 4.1 KB
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
// See https://aka.ms/new-console-template for more information
#region Practica1
Console.WriteLine("Cual es tu nombre");
string nombre = Console.ReadLine();
Console.WriteLine($"Hola Bienverido :{nombre}");
Console.WriteLine(DateTime.Now);
#endregion
#region Practica2
#region Ejercicio1
int edad;
string nombre1=null;
string apellido=null;
Console.WriteLine("Escriba su edad y presione enter, luego su nombre y enter luego su apeliido y enter");
edad = Convert.ToInt16(Console.ReadLine());
nombre1 = Console.ReadLine().ToString();
apellido=Console.ReadLine().ToString();
Console.WriteLine($"Bievenido al primer ejercicio de c# {nombre1} {apellido}, tienes una edad de {edad} anos");
#endregion
#region Ejercicio2
//Coche: puertas, ruedas, marca, ITV
int puertas = 4,ruedas=4;
string marca ="Honda", ITV="Nose Que es esto";
Console.WriteLine($"El Coche tiene {puertas} y {ruedas}, es de marca {marca}, y otra variable que nose {ITV}");
//Mesa: peso, largo, material, color
int peso = 123;
float largo= 123.15f;
string material = "Hierro";
string color = "azul";
Console.WriteLine($"La mesa tiene {peso} y {largo}, es de material {material}, y el color es {color}");
#endregion
#region Ejercicio3
char variable = 'a';
Console.WriteLine("Edad es mayor a 18 {0}", (edad > 18));
Console.WriteLine("son iguales {0}", (variable == 'a'));
Console.WriteLine("DOs condiciones verdaderas {0}",(edad > 18) && (variable == 'a') );
Console.WriteLine("1 y 1 condiciones {0}",(edad > 18) && (variable == 'b') );
#endregion
#endregion
#region Practica3
ClienteStruc cliente = new ClienteStruc("Braulio","8294492453","El Millon","braulio-alvarez@hotmail.com");
Console.WriteLine(cliente.ToString());
#endregion
#region Practica4
//Ejercicio 1
#region ejercicio1
int contador=0;
while(contador < 10)
{
contador++;
Console.WriteLine("Multiplicador{0} ", (1 * contador));
}
#endregion
//Ejercicio 2
#region ejercicio2
int entero;
int positivoContador=0;
int negatigoContador=0;
do
{
Console.WriteLine("Ingrese un numero entero y luego presione enter.. para finalizar ingrese un 0");
entero = Convert.ToInt16(Console.ReadLine());
if(entero > 0 )
{
positivoContador++;
Console.WriteLine($"El valor {entero} es positivo cantidad acumulada {positivoContador}");
}
else
{
negatigoContador++;
Console.WriteLine($"El valor {entero}, es negativo, cantidad acumulada {negatigoContador}");
}
}
while(entero != 0);
#endregion
#region ejercicio3
Console.WriteLine("Introduce el valor de la coordenada X como un entero");
int _x = Convert.ToInt16(Console.ReadLine());
Console.WriteLine("Introduce el valor de la coordenada Y como un entero");
int _y = Convert.ToInt16(Console.ReadLine());
Console.WriteLine("Introduce el bool es decir true si es relleno, false si no es relleno");
bool _b = Convert.ToBoolean(Console.ReadLine());
int i, j;
for ( i = 1; i <= _y; i++)
{
for (j = 1; j <= _x; j++)
Console.Write("*", j);
Console.WriteLine(" ");
}
#endregion
#endregion
#region Practica5
string Nombre, email;
bool cupon;
int productoCosto = 1582;
Console.WriteLine("Ingrese su nombre y presione Enter, Ingrese su email y presione enter, ingrese true o false si tiene o no un copon");
nombre = Console.ReadLine();
email = Console.ReadLine();
cupon = bool.Parse(Console.ReadLine());
if(cupon) Console.WriteLine("Cliente tiene un cupo{0}",(productoCosto - 100));
else Console.WriteLine("Cliente not tiene un cupo{0}",(productoCosto));
string[] lenguajes = {"C#","Java","Javascrip"};
for(int record=0;record < lenguajes.Length;record++)
{
Console.WriteLine("Ingrese el numero correspondiente al lenguaje que desea imprimir o saludar {0} para {1}",record,lenguajes[record]);
}
int valorIntroducido =int.Parse(Console.ReadLine());
switch (valorIntroducido) {
case (0):
Console.WriteLine("Hola {0}",lenguajes[valorIntroducido]);
break;
case (1):
Console.WriteLine("Hola otra condicion para forzar el switch {0}",lenguajes[valorIntroducido]);
break;
case (2):
Console.WriteLine("Hola otra por si acaso {0}",lenguajes[valorIntroducido]);
break;
default:
break;
}
#endregion