: I am needing to find the output of the following code fragment: : : vector v (10,5); : v.push_back (3); : cout<<v.front()<<""<<v.back(); : : Thanks in advance :
: I am needing to find the output of the following code fragment: : : vector v (10,5); : v.push_back (3); : cout<<v.front()<<""<<v.back(); : : Thanks in advance :
[blue]You don't have a compiler available to test it out? The constructor creates a [italic]vector[/italic] consisting of 10 instances of the value 5. The push_back statment of course will add the value 3 to the end of the [italic]vector[/italic]. It shouldn't be too hard to figure out what the [italic]front[/italic] and [italic]back[/italic] member functions would return in this case.[/blue]
I don't know anything about programming, so i hoped to have somebody let me know what the output would be. However, I did download visual c++ express and tried to compile it, but I received several syntex errors. Could you recommend what I should use to complile small programs like this?
Thanks
: : I am needing to find the output of the following code fragment: : : : : vector v (10,5); : : v.push_back (3); : : cout<<v.front()<<""<<v.back(); : : : : Thanks in advance : : : : [blue]You don't have a compiler available to test it out? The constructor creates a [italic]vector[/italic] consisting of 10 instances of the value 5. The push_back statment of course will add the value 3 to the end of the [italic]vector[/italic]. It shouldn't be too hard to figure out what the [italic]front[/italic] and [italic]back[/italic] member functions would return in this case.[/blue] :
: I don't know anything about programming, so i hoped to have somebody let me know what the output would be. However, I did download visual c++ express and tried to compile it, but I received several syntex errors. Could you recommend what I should use to complile small programs like this?
Comments
:
: vector v (10,5);
: v.push_back (3);
: cout<<v.front()<<""<<v.back();
:
: Thanks in advance
:
Compile it & run it. It usually does the trick.
:
: vector v (10,5);
: v.push_back (3);
: cout<<v.front()<<""<<v.back();
:
: Thanks in advance
:
[blue]You don't have a compiler available to test it out? The constructor creates a [italic]vector[/italic] consisting of 10 instances of the value 5. The push_back statment of course will add the value 3 to the end of the [italic]vector[/italic]. It shouldn't be too hard to figure out what the [italic]front[/italic] and [italic]back[/italic] member functions would return in this case.[/blue]
Thanks
: : I am needing to find the output of the following code fragment:
: :
: : vector v (10,5);
: : v.push_back (3);
: : cout<<v.front()<<""<<v.back();
: :
: : Thanks in advance
: :
:
: [blue]You don't have a compiler available to test it out? The constructor creates a [italic]vector[/italic] consisting of 10 instances of the value 5. The push_back statment of course will add the value 3 to the end of the [italic]vector[/italic]. It shouldn't be too hard to figure out what the [italic]front[/italic] and [italic]back[/italic] member functions would return in this case.[/blue]
:
The whole source should look like:
[code]
#include
#include
using namespace std;
int main()
{
vector v (10,5);
v.push_back (3);
cout<<v.front()<<""<<v.back();
return 0;
}
[/code]