Just a noob question.
I run the following code on visual studio release mode. And is finishing almost immidiatelly meaning running through long long largeNumber = 9223372036854775807 increasments at so little time.
So how that is possible?
#include <iostream>
using namespace std;
int main()
{
std::cout << "Hello World!\n";
int ok;
cin >> ok;
cout << "starting\n";
long long i=1;
while (i > 0) {
++i;
}
--i;
cout <<"last:" << i << "\n";
}
i was expecting that will take some seconds at least. I though that a processor lets say 3.40 GHz simply mean that can make up to 3.4 billion actions on a second.!
PS.in java seems to go as slow as i was expecting.
public class NewClass1 {
public static void main(String[] args) {
long ts=System.currentTimeMillis();
long i=1;
while(i>0){
++i;
}
long te =System.currentTimeMillis();
--i;
System.out.println("last: "+i +" in millis:"+(te-ts));
}
}```
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745156680a4614163.html
评论列表(0条)