Beginners - July 2010 (Page 21)

pass by reference and pointers
 
Lets say I have a function foo(bar &t) { //code } and in main I have main() { bar *t; foo(*t);//version that works foo(t); //compile error } ...
[5 replies] Last: Ok, thank you. (by smilodon)
Adding two polynomials with vector of structs
 
I am having problems primarily with the sorting function. What I need is for the polynomials after being entered to be sorted from the highest exponent to the ...
[1 reply] : Since I don't have the patience to read through 148 lines of code: ... (by smilodon)
The Ampersand and other reference/pointer stuff
 
I began learning c++ about two weeks ago with the online tutorial on cplusplus.com, which seems overall to be the best tutorial I've come across. I have bee...
[10 replies] Last: Yes, a reference must be initialized when declared in a local variable... (by Duthomhas)
Question on declaring members in classes
 
I'm having trouble understanding the rules on declaring members in classes. I have initialised the char 'piece' in the classes constructor and included it...
[6 replies] Last: Your welcome. (by smilodon)
Preventing duplication in 'Game Archiver' using iterators and vectors
 
Hello, I am working out of Dawson's 'Beginning C++ through game programming' and am working on an assignment which calls upon me to create a Game Archiver that ...
[8 replies] Last: Thanks for all the support and help everyone, I finally got it to run ... (by Futureboy)
CopyFile ?
 
This doesn't work: if I get last error I get error 3. Yes The file exists and yes I have access to change it because I am the administrator. int main() ...
[5 replies] Last: Thanks for the help, but I don't know what a POSIX i'm just running o... (by cabledevin)
how to insert an image?
 
when we make a simple program, the background is always black. how we insert an image or picture as a background? or just change the background color? what co...
[3 replies] Last: You can draw stuff in the Windows Console ... Here's a snippet p... (by Duthomhas)
passing pointer of array containing data type double
 
Hi I want to write a function which takes as input an array of INTEGERS and return another array which contains squares of the integers in input array.Follow...
[1 reply] : double *array = new int ; Here's the problem. If you use doubles use... (by hamsterman)
Generating random numbers between two numbers
 
I have started this program which is supposed to generate 10 random numbers between 1 and 100 (inclusive). Right now, the program is generating 10 random numbe...
[4 replies] Last: while (rand() % 100 +1); This line checks the condition for true ... (by AngelHoof)
Function in a Class Declaring Another?
 
Hey, I just started C++, but my book doesn't cover classes very thoroughly (yep). I want to have a class, class_1, with two functions, F_1 and F_2, with F_1...
[6 replies] Last: Ah. Excellent, thank you =) (by suffusion)
Arrays of Pointers
 
#include<iostream> using namespace std; const int size = 3; class AAAA { private: int item; AAAA* next; public: ...
[3 replies] Last: Although this is irrelevant to what the OP asked, I'll play along. ... (by m4ster r0shi)
pointers and dynamic memory allocation
 
Hello all, I have a question about dynamic memory allocation (if I'm in the wrong forum please let me know!). I wrote a small practice program to try to underst...
[7 replies] Last: I gather that you didn't read the whole topic. Because if you did, you... (by m4ster r0shi)
question loops
 
i need to use a loop but i am not sure exactly how. here is the senerio. i give a clue and the user has to guess the answer. if they get it wrong i give anot...
[3 replies] Last: First make an 2 dimensional array of chars and write in your hints. ... (by jackabascal)
Rotating a lineshape in visual c++ (1,2)
 
Hey all! I found something interesting i would like to do, but i cant seem to figure out how to do it. In vc++ you can draw lines that have x1,x2,y1,y2. All i...
[24 replies] Last: If the shape occupies that region, it's center should be at (310,310) ... (by Bazzy)
Not allow user to input string
 
Hi! Can you show me an example of code that doesn't allow user to input string or char when program asks for an int? Simple code is better. It is easier to c...
[3 replies] Last: thanks a lot Bazzy. I didn't notice your reply. Thanks a lot anyway. (by aladar04)
Insertion-Sort Progress Bar
 
Hi people! I make my own insertion-sort algorithm and I put a progress bar to print in the screen the progress of sort for big numbers. Can anyone help me...
[4 replies] Last: Exactly what I was looking for! Thank you! (by brazyuri86)
vector words compare
 
Hello, i don't understand 1 little thing: if (words[i-1]!=words ) // is this a new word? This code snippet must to compare 2 words in vector to see if ...
[4 replies] Last: If the vector is sorted then identical words will be adjacent. (by Galik)
by xyzt
is std::cout thread safe?
 
std::cout object is defined as: [Stroustrup says in his book] namespace std { class ostream { //... ostream& operator<<(const char*); }; extern ostream...
[1 reply] : Yes, however if you run this in two different threads: cout << "He... (by Athar)
Array of strings to store data...
 
Good evening! I am working on a problem where I need to use an array of strings to store email addresses. The user of the program should be able to list all ...
[7 replies] Last: I really think you should avoid using recursion like that (calling pro... (by Galik)
newbie
 
I have been given the task to try and understand a C++ program written by someone else....actually my job is to setup and test the hardware...in order to unders...
[3 replies] Last: Say you have an object foo, and its type has a member named bar. You w... (by filipe)
July 2010 Pages: 1... 1920212223... 31
  Archived months: [jun2010] [aug2010]

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