Está en la página 1de 10

/*

#include<iostream>
#include<stdlib.h>
#include<time.h>
#include <math.h>
using namespace std;

void main(){
srand((unsigned)time
(NULL));

char ope;
double a,b;

a=rand()%21;
b=rand()%21;
a=1;b=1;
cout<<"a ="<<a<<endl;
cout<<"b ="<<b<<endl;

cout<<endl;

cout<<"Ingrese la
opcion: ";
cin>>ope;

switch(ope){
case '&':
if(a>0){
cout<<(((2*a)-
b)/(2*a))<<endl;
}
else {
cout<<"No existe
Solucion "<<endl;
system("pause");
exit(0);} ;break;
case '#':
if((a+b)>0){

cout<<powf((a+b),(1.0
/30))<<endl;
}
else {
cout<<"No existe
Solucion "<<endl;
system("pause");
exit(0);
};break;
case '?':
if(a-b>=0){
if(a>sqrtf(a-b))
cout<<sqrtf(a-
sqrtf(a-b))<<endl;
}
else {
cout<<"No existe
Solucion "<<endl;
system("pause");
exit(0);};break;

case '@':
if(a-b>0){
cout<<(a/(sqrtf(a-
b)))<<endl;
}
else {
cout<<"No existe
Solucion "<<endl;
system("pause");
exit(0);}
;break;

case '!':exit(1);
default:cout<<"No
corresponde a las
opciones ";
cout<<endl;break;
cout<<endl;
}
system("pause");

//serie 1-....
#include<iostream>
#include<stdlib.h>
#include<iomanip>
#include <math.h>
using namespace std;
void main(){
int N,i=1;double S=0;
cout<<"Ingrese el
numero de terminos N=
";cin>>N;
while(i<=N){
S+=powf(-
1,i+1)*powf(2*i-
1,1.0/(2*i-1));
i++;
}
cout<<"La suma de los
primeros terminos=
"<<setiosflags(ios::fi
xed||ios::showpoint)<<
setprecision(12)<<S<<
endl;
system("pause");
}
*/
//cara o sello
#include<iostream>
#include<stdlib.h>
#include<time.h>
#include <math.h>
using namespace std;

void main(){
srand((unsigned)time(
NULL));
int c=0,s=0,N,i=1,M;
cout<<"N= ";cin>>N;
M=rand()%2;
while(i<=N){
if(M==0)
c++;
else
s++;
i++;
}
cout<<"Caras=
"<<c<<endl
<<"Sellos=
"<<s<<endl;
system("pause");
}

También podría gustarte