if there is a way to make Visual Studios step into a function while I am debugging.. I am trying to see the value of a certain int and making sure it is what I need it to be.. but whenever I use step into visual studios just skips right over the function and it does all the calculations..
I need to develop a tool to compare geometric structure of point cloud from scanned objects with their CAD model. The CAD model is stored in step file. So how could I extract geometric information from step file? I am totally new for CAD.
I am building a project using Ogre3D, and I've downloaded the source code of the SDK.
For whatever reason, the program has got a bug. And I want to know what is going on within the SDK, how do I include the SDK source in Visual Studio 2010?
When I use vectory.push_back(obj), if the length is out of reserved bound, it will deallocate the whole vector and reallocate a big piece of memory. From my understanding I think c++ only allocates 1 more place for the new obj. This is quite inefficient. Is there a way to set the step length whenever the size is out of bound? e.g. 50 more spaces.
void armazenaFA( std::vector <int> &vFA) // this function only knows about vFA { vsFA[n] [m]= simTime().dbl(); OR vsFA[n].push_back(simTime().dbl()); }
I'm trying to create a function that uses dynamic allocated arrays instead of vectors because I want to see how they work. Basically, this function asks the user to input how many people they are going to enter followed by their name; then, they enter how many of these people want to register for an ID followed by their phone #.
For example:
"How many customers will you like to enter? " 3 //user inputs 3 Bob Allen //user input Ellen Michaels //user input Jane Andrews //user input
I have a .cpp file which I have to create a header file for. I started it but I have stuck and it is full of errors.
I have some tasks (see comments in the code):
Task 2: I have to write a template which defines min max operators on vectors, it must be a custom vector template. The main program only demonstrates that it creates a data structure which calls for min max operators.
Task 3: I need a special min max function which watches for any changes and it has to work lineally so it has to step along the elements of the vectors determining the min max values.
This is probably a very basic question, but I need to create two vectors and then loop through the vectors and output each pair that is found.
The user will input min1 and max1 with step1 for the first vector and min2 and max2 and step2 for the second vector. Then the loops will go through and return the combinations will return each pair of the two vectors.
So if I input min1=1 and max1=10 and step1=1 and same for vector two the return would be:
[1,1] [1,2] . . . [10,10]
This is for part of a homework assignment, but I can't continue on the assignment without first getting this simple part to work.
So I have a base class, lets call it base. In base I have a virtual function called update(), update just couts "base" then I have a class derived from base called derived;
it has a function called update(), update just couts "derived" then I create a vector called Vec it's initialised like this:
std::vector<base> Vec;
then I add an element into it like this
Derived DerElement; Vec.push_back(DerElement);
then when I type:
for (int i=0; i<Vec.size(); i++) { Vec.at(i).Update(); }
It outputs:
Derived DerElement2; DerElement2.Update();
and it outputs this:
#include <iostream> #include <vector> class Base { public: virtual void Update() {
I want to add 2 vectors to print out so that there on the same line. What I am trying to make is an inventory system that will use 2 vectors to keep the pounds of the item and list the 2 vectors on one line.
(I am using Microsoft Visual C++ 2010 Express)
Like this:
0. empty 0 1. empty 0 2. empty 0
etc...
Right now it looks like this:
0. empty 0. 0
The code:
#include "stdafx.h" #include <iostream> #include <vector> #include <string> #include <fstream> #include <cmath> using namespace std; int main() { vector<string> inv;
I have a vector I want to add book titles to, then i want to print my updated vector. This is best I have come up with but the program fails at the getline line. why?
string book; cout << "Enter book to add: "<< endl; getline(cin, book); books.push_back(book); for(int i = 0; i < books.size(); ++i) { cout << i+1 << ". " << books[i] << endl; }
I'm trying to make it like a game. You would fire your gun, then have the option of reloading. If you run out of ammo and try to fire...it will automatically come out of your cache. Anyone who played a 3rd or first person shooter knows what I mean. I thought vectors would be the best course of actions since they can remove and add elements with ease. One of the many problems I have is subtracting the Hand Guns current ammo (size) from its maximum (capacity) to see how much to A. push_back into the clip and B. pop_back out of the cache. Can size() and capacity even be subtracted? Here's the code with what I believe to be all the possibilities.
#include<iostream> #include<vector> using namespace std; int main(int argc,char** argv) { vector<int> HG_cache (36,1); vector<int> HG_clip (12,1); char user_input;
I am trying to use push back in a 2D vector but I don't know how to. This is what I have:
vector <vector <BigInt> > matr;
for (BigInt i=0;i<rij;i++) { for (BigInt j=0;j<kolom-1;j++) { matr.push_back().push_back((i+1)^(pow-j)); } }
I quickly invented something but that doesn't work obviously. it should be equivalent to this: (the only problem in the code below is that those indexes don't exist yet that's why I need push_back())
for (BigInt i=0;i<rij;i++) { for (BigInt j=0;j<kolom-1;j++) { matr[int(i)][int(j)]=(i+1)^(pow-j); } }
My program works fine with a small number of insertions to v. However, with a huge number of insertions my program stops working without telling me the reason... I guess that vectors might not grow after a certain size (im not sure)
1. What is the maximum size that a vector of vectors can grow? 2. I'm using Microsoft visual studio 2012, Is their anything I can do with the settings to increase the size of my vector? something beyond 1000000 rows?
I've seen code examples for assigning 2 dimensional vectors, but I haven't seen code for assigning more than that. I tried to create a 3 dimensional vector, and the only code the IDE didn't complain about was
int x = 2; int y = 2; int z = 2; vector < vector < vector <string> > >stringvec; stringvec.assign(x, vector <string>(y), vector <string>(z));
Would this be the correct way of producting a vector[2][2][2]?
I have a CSV file that is formatted in the following way. The top row contains headers and the data is below. I have opened the file (sec2011) in Numbers on Mac and saved it as a csv. I would like to read each of the columns into a vector, but I can not get the code to even open the file.
secid,date,low,high,close,volume,return,cfadj,open,cfret,shrout 101310,03JAN2011,181.21,186,184.22,5331413,0.023444,12,181.37,12,448837 101310,04JAN2011,183.78,187.6995,185.01,5033144,0.004288,12,186.15,12,448837 ifstream infile("sec2011.csv"); if (!infile) { cerr << "Couldn't open file!"<<endl; return 1;
This code always returns the Couldn't open File text.
What am I doing wrong. I know the above code doesn't put the data into vectors, but I can't even get the file to read.
I'm trying to solve Project Euler 16 where you have to calculate 2^1000. SO I made a program that would solve multiplying a number b a single digit factor through manual multiplication in a vector, just to test things out.
The problem is when I take things out of main and try to make a separate function, the original number is never multiplied.
Here's my code with functions...
/*Using vectors manually to multiply a number to a positive power.*/ #include <iostream> #include <vector> using namespace std; void print_vector(const vector<int>& v);
[code]....
Here is the other code, not using functions but even if I use an extra for loop to multiply by the same factor several times, it still does the same thing.
/*Using vectors manually to multiply a number by two (or any single digit factor).*/ #include <iostream> #include <vector> using namespace std; void print_vector(const vector<int>& v);