'cout': undeclared identifier
'endl': undeclared identifier

uyarısı alıyorum. void fonksiyonun içinde kullandım diye mi oldu ki? yoo void içinde bunları yapmicaksak napcaz zaten. ya çok saçma be bi el pls.

 

kodu paylaşırsan daha iyi yorum yapılabilir.

tannen

void diye olmaz. tek farkı void'de return değeri yoktur.

nuka cola

#include <iostream>
#include <cstdlib>
#include <ctime>

/*

Write a program that simulates coin
tossing experiment for 1000 times.
The program will print the total
number of heads and tails.

*/

void flip ()
{
srand(time(0));
int a, heads, tails;

for (int i=1; i<=1000; i++)
{
a=rand()%2;
if (a==0)
heads++;
else
tails++;
}
cout<<heads<<" times for heads."<<endl;
cout<<tails<<" times for tails."<<endl;
}

int main()
{
flip();

return 0;
}

rubenanyukov

using namespace std;

eklemelisin void flip() ten önce.

veya std::cout ile std::endl şeklinde de kullanabilirsin.

tannen

aa, belliydi noob olduğu eyvallah sağ olun.

rubenanyukov

dediklerinden alakasız olarak şu www.java2s.com adreste bir çok örnek mevcut.

Yehova
1

mobil görünümden çık