Beginners - November 2012 (Page 25)

by SMA01
How do I do this?
 
This is for my online computer science work, and I can't figure out how to start: Assume that PrecinctReport is a structured type with these fields, address ...
[1 reply] : You just need to loop through the array and sum the numbers in each el... (by freddy92)
Declaring Global Variables and/or Workaround
 
I'm using Code::Blocks and the GNU compiler, and I have a multi-file program. I have multiple functions in different files using the same variables. How do I ma...
[6 replies] Last: oh, you can do that? Interesting, I will investigate. (New to C++) (by bosox99)
Syntax Error
 
Hi. I'm making my first program. It's a simple calculator. I'm running it in Code::Blocks with a GNU GCC compiler on a Mac. The code is: #include <iostrea...
[2 replies] Last: You have multiple places where you do stuff like if cin >> 0 What y... (by freddy92)
erase element from vector
 
say I have a vector with 8(0-7) elements. How do I delete the 4th element? vec.erase(vec.begin() +4); or vec.erase(vec.begin() +3); I've seen this code:...
[1 reply] : In the second line, myvector.begin()+0 would be the 1st element, +1 wo... (by freddy92)
Reusing a pointer
 
Let's say we have this situation: int* arr = new int ; //Do some stuff that alters arr //Now I want a fresh array to work with delete arr; arr = new...
[5 replies] Last: You could treat a pointer on which a "delete" has been applied to prac... (by Ramses12)
pointers to objects
 
Student *a; Student *b = new Student(); Student *c = new Student(); a=b; b=c; c=a; is this ^ the right way to switch between pointers?
[2 replies] Last: If you don't want to write the code for swapping two things yourself ... (by Peter87)
by G3PO
Pointer Question
 
I'm doing a very simple pointer program just pointing to addresses and printing them, but I can't seem to grasp what I'm doing. I read through the page on point...
[5 replies] Last: What does it mean to "dynamically create" something? For example, le... (by ResidentBiscuit)
Xcode Message "TERM environment variable not set"
 
I'm getting this message in my console when i'm compiling this code. I'm using Xcode and have searched the internet for related issues. I come up with related t...
[no replies]
by Hucaru
Vector of class type.
 
Hi I am making an address book and it is going smoothly, however I have come across an issue that has been solved but I do not why it is fixed. If that makes se...
[2 replies] Last: Thanks I understand it now. (by Hucaru)
break two loops
 
I am suffering from the problem please anyone help me I have the following condition j=0; while(j<9){ for(i=0;i<10;i++){ //statements if(condition){ //...
[3 replies] Last: A nice and clean way to do that is to use a goto. j=0; while(j<9) {... (by toum)
no match to call
 
I'm having an error when I'm creating an object "as no match to call" My method is: void CPoiDatabase::addPoi(t_poi type, string name, string description, ...
[3 replies] Last: If I understand correctly, you want to store into m_POI the object of... (by toum)
Why use dereference operator on iterators?
 
vector<string>::iterator myIter; vector<string>::const_iterator iter; vector<string>weap(3); string userInput; cout << "Enter 3 weapons: " << endl; ...
[3 replies] Last: Ah, that's more clear. Thanks :D (by DJLad16)
vector of pointers
 
I was wondering if there is a difference between: vector<Course*> courses; Course* cs = new CScourse(); //CScourse inherits Course courses.push_back(cs)...
[5 replies] Last: got it! Thnx! (by eliranko)
Initializing array with function return value
 
Alright so I've got a function that creates an array that I need passed back to main(). How do I go about doing this and using this array as I would any other? ...
[4 replies] Last: Ah that is much smarter haha. Worked perfectly. (by ResidentBiscuit)
by Ameki
Stumped with IF
 
Hi Guys, I'm new here and was wondering if anyone can help me on this one problem I'm having, or explain whats wrong so I can at least 'try' and sort it out. ...
[4 replies] Last: After putting that in the code works, sat back and pondered and realiz... (by Ameki)
Hi... Newbie here.
 
Hi everybody, I was hoping to introduce myself and get some advice. I was assigned to create an app using Visual C++ for my CS161 class, and I'm still fairly...
[4 replies] Last: Ah, ok. So it's displayed for 1 sec, and then they have to type wha... (by andywestken)
by Niven
Help with textures
 
I'm trying to create a program that loads an image using SDL and converts it to an Opengl Texture then displays that texture on a square. It sounded simple enou...
[7 replies] Last: I'm having a new problem now. The images are being displayed (finally)... (by Niven)
write to file multiple times
 
hello, I have a problem with writing to the same file in seperate cases. I opened a file ofstream myfileRandom("random.log"); if(myfileRandom.is_op...
[4 replies] Last: Thank you guys! works now (by eliranko)
RTS Drag-box math
 
I'm working on an small RTS project and I've created a drag box to select units with but I'm not sure what the math is to work out if a unit should be selected ...
[7 replies] Last: You only need at most 2 for loops: One for each rectangle One for ... (by Disch)
how can I make these ones to reduce.
 
Okay so I got everything work on my code except this one part which I am not sure how I would. There are 3 files and one I am not allowed to change. Here is the...
[2 replies] Last: Thank you I got it! (by OLittleO)
November 2012 Pages: 1... 2324252627... 75
  Archived months: [oct2012] [dec2012]

This is an archived page. To post a new message, go to the current page.