• (3 Pages)
  • +
  • 1
  • 2
  • 3

C++ Vector Tutorial Constructors, accessing elements, and getting internal state informati Rate Topic: ***** 10 Votes

#16 bmkrish  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 24-August 11

Posted 27 August 2011 - 05:09 AM

Im having Turbo C++ IDE.. But it does not support vector instructions.. There is no vector header file.. can u send any link to download c++ that supports vector instructions..
Was This Post Helpful? 1
  • +
  • -

#17 bmkrish  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 24-August 11

Posted 27 August 2011 - 05:23 AM

View PostPlasticineGuy, on 24 August 2011 - 10:45 PM, said:

Every one that complies with standard C++. Just use:
#include <vector>

I compiled the vector safe access code.. But it show errors like unable to open include file vector, undefined symbol vector etc..
Was This Post Helpful? 0
  • +
  • -

#18 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6075
  • View blog
  • Posts: 23,542
  • Joined: 23-August 08

Posted 27 August 2011 - 07:34 AM

How about using a compiler from this century?
Was This Post Helpful? 1
  • +
  • -

#19 Hadean Fall  Icon User is offline

  • D.I.C Head


Reputation: -5
  • View blog
  • Posts: 241
  • Joined: 05-September 11

Posted 05 September 2011 - 08:54 AM

great tutorial, really helped me a lot
Was This Post Helpful? 0
  • +
  • -

#20 bmkrish  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 24-August 11

Posted 06 September 2011 - 08:39 AM

View PostPlasticineGuy, on 24 August 2011 - 10:45 PM, said:

Every one that complies with standard C++. Just use:
#include <vector>

pls send a link to download c++ which supports vector instructions
Was This Post Helpful? 0
  • +
  • -

#21 bmkrish  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 24-August 11

Posted 07 September 2011 - 02:05 AM

can you send a link to download c++ that supports vector instructions
Was This Post Helpful? 0
  • +
  • -

#22 Gunborg  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 23-December 11

Posted 24 December 2011 - 10:24 AM

This was a great tutorial, I hope you make some more soon.
Was This Post Helpful? 0
  • +
  • -

#23 herpienne12  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 25
  • Joined: 02-November 11

Posted 26 December 2011 - 08:32 PM

int main(int argc, char** argv)


what does that mean?

catch (exception& e)


what does that exception& e suppose to do?
Was This Post Helpful? 0
  • +
  • -

#24 Karel-Lodewijk  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 449
  • View blog
  • Posts: 849
  • Joined: 17-March 11

Posted 27 December 2011 - 03:44 AM

View Postherpienne12, on 27 December 2011 - 03:32 AM, said:

int main(int argc, char** argv)


This is how C/C++ take in command line parameters. Try compiling a small program like this:

#include <iostream>

int main(int argc, char** argv) {
    for (int i = 0; i < argc; ++i) {
        std::cout << "parameter[" << i << "]: "<< argv[i] << std::endl;
    }
    return 0;
}



The first parameter will always be the name of the executable, the others are whatever you provide.


View Postherpienne12, on 27 December 2011 - 03:32 AM, said:

catch (exception& e)


A try block can be followed by one or more catch blocks like this. Then when an exception is thrown (with the throw statement), it jumps to the first catch statement (even when the exception happened within other functions), which matches the exception. The exception type here stands for std::exception and stl library only throws exceptions that inherit from std::exception, So this will capture them all. If there is no catch statement that matches an exception, the program will exit and the error will be printed to the console.
Was This Post Helpful? 0
  • +
  • -

#25 theNewb1e  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 28-December 11

Posted 28 December 2011 - 08:37 PM

Very helpful....on to the next part...:smile:
Was This Post Helpful? 0
  • +
  • -

#26 Trepach  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 26-August 12

Posted 26 August 2012 - 04:25 PM

View PostPlasticineGuy, on 24 August 2011 - 10:45 PM, said:

Every one that complies with standard C++. Just use:
#include <vector>

I dont seem to be able to declare a class-wide vector in the header, next to the other class members. How do I do that?
Was This Post Helpful? 0
  • +
  • -

#27 Trepach  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 26-August 12

Posted 26 August 2012 - 06:20 PM

I've found the answer. I tried to set the vector size while declaring it in the header file which was the problem.
P.S. how do I edit my posts?
Was This Post Helpful? 0
  • +
  • -

#28 sebwerner  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 30-September 12

Posted 09 October 2012 - 07:17 AM

Good tutorial! Thank you!!
Was This Post Helpful? 0
  • +
  • -

#29 Hari291988  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 11-October 12

Posted 11 October 2012 - 10:03 PM

Really a nice turorial on vectors.
Was This Post Helpful? 0
  • +
  • -

#30 xconwing  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 39
  • Joined: 22-May 13

Posted 06 August 2013 - 09:38 AM

That's odd, the last program doesn't produce the same output as your posted output. No, I'm not talking about the value from random. The part where the vector having 15 elements and the last 5 elements suppose to be 0. For me, those last 5 elements seem like junk integer.

-X
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3