#include<iostream>
#include<cstdlib>
using namespace std;
int main(){
char letra='a';
int n_a=0,n_e=0,n_i=0,n_o=0,n_u=0;
for ( ;tolower(letra)!='x';){
cin>>letra;
switch(tolower(letra)){
case 'a': n_a++;break;
case 'e': n_e++;break;
case 'i': n_i++;break;
case 'o': n_o++;break;
case 'u': n_u++;break;
}
}
cout<<"Total de 'a's :"<<n_a<<endl;
cout<<"Total de 'e's :"<<n_e<<endl;
cout<<"Total de 'i's :"<<n_i<<endl;
cout<<"Total de 'o's :"<<n_o<<endl;
cout<<"Total de 'u's :"<<n_u<<endl;
system("PAUSE");
}
#include<iostream>
#include<cstdlib>
using namespace std;
int main(){
int mes;
cout<<"Ingrese mes (1..12):";
cin>>mes;
int num_dias;
switch (mes){
case 2: num_dias=28;break;
case 4:case 6:case 9:case 11:
num_dias=30;break;
case 1:case 3: case 5: case 7:
case 8: case 10: case 12:
num_dias=31;break;
default: cout<<"mes invalido"
<<endl;
}
cout<<"tiene "<<num_dias
<<" dias"<<endl;
system("PAUSE");
}
#include<iostream>
#include<cstdlib>
using namespace std;
int main(){
float E=0;
float termino=1;
int signo=1;
int n;
cout<<"n=";cin>>n;
for(int i=1;i<=n;i++)
{
E+=termino;
signo*=-1;
termino=signo/(2.0*i+1);
}
cout<<"E="<<E<<endl;
system("PAUSE");
}
#include<iostream>
#include<cstdlib>
using namespace std;
int main(){
for (int i=1;i<=128;i++){
cout<<i<<"\t"<<(char) i<<endl;
}
system("PAUSE");
}
#include<iostream>
#include<cstdlib>
using namespace std;
int main(){
for (int i=1;i<=7;i++){
int inicio=97;
for (int j=1;j<=i;j++){
cout<<(char)inicio<<" ";
inicio++;
}
cout<<endl;
}
system("PAUSE");
}
No hay comentarios:
Publicar un comentario