How to use <chrono> in C++ Microsoft Visual?

I am using Microsoft visual 2010 for my c++ homework and the thread <chrono> and <thread> cannot be opened.

Is it not installed in the version or named differently?

I need it to use a function 'sleep_for'.

thanks.

Visual studio 2010 has a partial c++11 if you want to use all (or most) of the features you should get VS2012. http://msdn.microsoft.com/en-us/library/vstudio/hh567368(v=vs.110).aspx
I'm sorry i didn't use it, cause i am creating my own sleep function.
@CodeLearner You're doing their homework for them or something? If so please stop, you are only hurting them. If not what are you talking about?
I don't know if I'm doing his/her homework, he just ask the sleep function and i don't know the syntax of it. So i suggest to make her own sleep function like what i always did in every language
Last edited on
@CodeLearner "i always did in every language". Perhaps you can give me a hint on its algorithm? and also, either I am a boy or a girl so make up your mind. Thanks for your help so far, but you are making me confused as much as you.
I am using loop inside loop to delay the time.. here is my code

I think this is also the code in delay or in thread in every language..

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
string name = "abcdefghijklmnopqrstuvwxyz";
int milisecond=500;//not so accurate

for(int z=0; z<name.length(); z++)
{
	cout<<name.substr(z,1);

         /*delay function*/
	for(int a=0; a<milisecond; a++)
	{
		for(int b=0; b<500000; b++)
		{

		}
	}
        /* end of delay */

}

Last edited on
I am using loop inside loop to delay the time.. here is my code

I think this is also the code in delay or in thread in every language..

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
string name = "abcdefghijklmnopqrstuvwxyz";
int milisecond=500;//not so accurate

for(int z=0; z<name.length(); z++)
{
	cout<<name.substr(z,1);

         /*delay function*/
	for(int a=0; a<milisecond; a++)
	{
		for(int b=0; b<500000; b++)
		{

		}
	}
        /* end of delay */

}
So what happens if my computer is faster than yours?
Topic archived. No new replies allowed.