🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.c
Article #309671

Re: Dlaczego ten test nie działa

#309671
From: Piotr S.
Date: Thu, 12 Apr 2018 10:33
29 lines
2085 bytes
W dniu 2018-04-12 o 09:56, Maciek pisze:
> 
> To jesteś mi w stanie wytumaczyć dlaczego poniższa funkcja nie działa:
> 
>              unsigned int a=0, b=0, c=0, d=0, result=0;
>              unsigned int op_per_sec;
>              std::clock_t c_before, c_after=0;
>              c_before=std::clock();
>              std::vector<unsigned int> vec(1000000);
>              for(unsigned int i=0; i<100000000; ++i) {
>                  result = a+b+c+d;
>                  ++op_per_sec;
>                  c_after = std::clock();
>                  if((double(c_after - c_before)/CLOCKS_PER_SEC)>=1.0)
>                  std::cout<<"IN FUNCTION "<<__func__<<"OP PER SEC IS : "<<op_per_sec<<"    \r";
>                  std::cout.flush();
>                  c_before = std::clock();
>                  op_per_sec = 0;
>              }
>          }
> 
> konkretnie linia                 std::cout<<"IN FUNCTION "<<__func__<<"OP PER SEC IS : "<<op_per_sec<<"    \r";
> 
> nic mi nie wypisuje.
> 

Może problemem jest instrukcja sterująca "if"?

P.S.
Technical Details
Message-ID: <panclm$bf1$1@news.icm.edu.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!.POSTED!not-for-mail
References: <11e93e39-69fc-4ee2-8886-9d077c8026fb@googlegroups.com> <2750bf86-40ef-4907-90fd-89e8542c0183@googlegroups.com> <a6c0bdb8-b0e7-4628-a7d6-bf79907261a2@googlegroups.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!.POSTED!not-for-mail
From: "Piotr S." <sashxat@interia.pl>
Newsgroups: pl.comp.lang.c
Subject: Re: Dlaczego ten test nie działa
Date: Thu, 12 Apr 2018 12:33:28 +0200
Organization: ICM, Uniwersytet Warszawski
Lines: 29
Message-ID: <panclm$bf1$1@news.icm.edu.pl>
References: <11e93e39-69fc-4ee2-8886-9d077c8026fb@googlegroups.com> <2750bf86-40ef-4907-90fd-89e8542c0183@googlegroups.com> <a6c0bdb8-b0e7-4628-a7d6-bf79907261a2@googlegroups.com>
NNTP-Posting-Host: phb170.internetdsl.tpnet.pl
Mime-Version: 1.0
X-Trace: news.icm.edu.pl 1523529206 11745 46.171.183.170 (12 Apr 2018 10:33:26 GMT)
X-Complaints-To: usenet@news.icm.edu.pl
NNTP-Posting-Date: Thu, 12 Apr 2018 10:33:26 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0
In-Reply-To: <a6c0bdb8-b0e7-4628-a7d6-bf79907261a2@googlegroups.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit