Ayuda, al compilar el siguiente codigo me marca algunos errores. No entiendo que pasa o que falta.
Publicado por Juan (1 intervención) el 19/03/2015 23:26:24
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
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <vector>
using namespace std;
int main()
{
vector<double>vec;
srand((unsigned)time(0));
double random_integer;
int n;
int contador=0;
double total=0;
double r=RAND_MAX;
double producto=1;
cout cin>>n;
for(int i=0; i<n i=""> {
do{
random_integer = rand()/r;
cout producto*=random_integer;
contador++;
} while (producto>=0.25);
vec.push_back (contador-1);
cout contador=0;
producto=1;
total+=vec[i];
}
cout return 0;
}
</n>
Al compilar el programa marca lo siguiente:
Compiled with /EHsc /nologo /W4 /c
main.cpp
main.cpp(19): error C2146: syntax error: missing ';' before identifier 'cin'
main.cpp(21): error C2146: syntax error: missing ';' before identifier 'i'
main.cpp(21): error C2059: syntax error: '{'
main.cpp(21): error C2143: syntax error: missing ';' before '{'
main.cpp(25): error C2146: syntax error: missing ';' before identifier 'producto'
main.cpp(29): error C2146: syntax error: missing ';' before identifier 'contador'
main.cpp(33): error C2143: syntax error: missing ';' before 'return'
main.cpp(36): error C2059: syntax error: '<'
Valora esta pregunta
0