我的编译错了? [英] My compiler wrong?
问题描述
这实际上是一个持续的帖子。我很困惑。为什么
以下代码不起作用?你能帮帮我吗?或者请告诉
我是否适合你。那么我的
编号应该是个问题。
非常感谢!!!
Michael
#include< iostream>
#include< vector>
int main()
{
std :: vector< intv(10,1);
for(int i = 0; i< 10; i ++)
{
std :: cout<< v [" << i<< " ] =" << v.at(i);
std :: cout<< std :: endl;
}
返回0;
}
Hi,
This is actually a continued post. I am soooo confused. Why do the
following codes not work? Could you please help me out? Or please tell
me whether it works for you. Then it should be a problem with my
complier.
Thanks a lot!!!
Michael
#include <iostream>
#include <vector>
int main()
{
std::vector<intv( 10, 1 );
for( int i = 0; i < 10; i++ )
{
std::cout << "v[ " << i << " ] = " << v.at(i);
std::cout << std::endl;
}
return 0;
}
推荐答案
Michael写道:
Michael wrote:
这实际上是一个继续发帖。我很困惑。为什么
以下代码不起作用?你能帮帮我吗?或者请告诉
我是否适合你。然后它应该是我的
编译器的问题。
Hi,
This is actually a continued post. I am soooo confused. Why do the
following codes not work? Could you please help me out? Or please tell
me whether it works for you. Then it should be a problem with my
complier.
你是什么意思,不工作?我们不知道你的期望是什么,或者代码实际上做了什么。
Brian
What do you mean, "not work"? We have no idea what your expectations
were, or what the code actually did.
Brian
Michael写道:
Michael wrote:
#include< iostream>
#include< vector>
int main()
{
std :: vector< intv(10,1);
for(int i = 0; i< 10; i ++)
{
std :: cout<< v [" << i<< " ] =" << v.at(i);
std :: cout<< std :: endl;
}
返回0;
}
#include <iostream>
#include <vector>
int main()
{
std::vector<intv( 10, 1 );
for( int i = 0; i < 10; i++ )
{
std::cout << "v[ " << i << " ] = " << v.at(i);
std::cout << std::endl;
}
return 0;
}
适合我。输出:
news_groupa.out
v [0] = 1
v [1] = 1
v [2] = 1
v [3] = 1
v [4] = 1
v [5] = 1
v [6] = 1
v [7] = 1
v [8] = 1
v [9] = 1
Best
Kai-Uwe Bux
works for me. output:
news_groupa.out
v[ 0 ] = 1
v[ 1 ] = 1
v[ 2 ] = 1
v[ 3 ] = 1
v[ 4 ] = 1
v[ 5 ] = 1
v[ 6 ] = 1
v[ 7 ] = 1
v[ 8 ] = 1
v[ 9 ] = 1
Best
Kai-Uwe Bux
文章< 11 ******** *************@h48g2000cwc.googlegroups。 com>,
" Michael" < mi ******* @ gmail.comwrote:
In article <11*********************@h48g2000cwc.googlegroups. com>,
"Michael" <mi*******@gmail.comwrote:
这实际上是一个继续帖子。我很困惑。为什么
以下代码不起作用?你能帮帮我吗?或者请告诉
我是否适合你。那么我的
编号应该是个问题。
非常感谢!!!
Michael
#include< iostream>
#include< vector>
int main()
{
std :: vector< intv(10,1);
for(int i = 0; i< 10; i ++)
{
std :: cout<< v [" << i<< " ] =" << v.at(i);
std :: cout<< std :: endl;
}
返回0;
}
Hi,
This is actually a continued post. I am soooo confused. Why do the
following codes not work? Could you please help me out? Or please tell
me whether it works for you. Then it should be a problem with my
complier.
Thanks a lot!!!
Michael
#include <iostream>
#include <vector>
int main()
{
std::vector<intv( 10, 1 );
for( int i = 0; i < 10; i++ )
{
std::cout << "v[ " << i << " ] = " << v.at(i);
std::cout << std::endl;
}
return 0;
}
我得到的输出是:
v [0] = 1
v [1] = 1
v [2 ] = 1
v [3] = 1
v [4] = 1
v [5] = 1
v [6] = 1
v [7] = 1
v [8] = 1
v [9] = 1
这正是我期望得到的。
你得到了什么?你有什么期待?
The output I got was:
v[ 0 ] = 1
v[ 1 ] = 1
v[ 2 ] = 1
v[ 3 ] = 1
v[ 4 ] = 1
v[ 5 ] = 1
v[ 6 ] = 1
v[ 7 ] = 1
v[ 8 ] = 1
v[ 9 ] = 1
Which is exactly what I was expecting to get.
What did you get? What were you expecting?
这篇关于我的编译错了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!