Beginners - November 2009 (Page 4)

Linear Search
 
#include <cstdlib> #include <iostream> using namespace std; int busca_linear (int v , int dim, int num) { for (int i=0; i<dim; i++) { ...
[3 replies] Last: Remove the } you have before those lines (by Bazzy)
QString::toWCharArray error LNK2019
 
Hi! I'm fairly new to programming in C++ (only done Java before). I try to read data from a *.dat file. As this file is selcted by the user via a GUI(done wit...
[11 replies] Last: Goto the project settings in VS and uncheck the Treat wchar_t as a bui... (by jmnemonic)
General Programming Q - Is this bad?
 
Is declaring a variable in a loop bad? I'd imagine it is bad practice, but does it have implications on the performance of the program? Every time you re-define...
[1 reply] : 1) It's not bad and it shouldn't slow down the program 2) See http://... (by Bazzy)
Overloading Operators
 
(I think that is what it is called)... I'm currently building a matrix class and I'm trying overload the * and + operators. See some code below: cl...
[7 replies] Last: Excellent! Thanks so much :) Nick (by NickPaul)
Two Dimensional Arrays.
 
I have to write a program that displays ticket prices to users in a 9x10 grid. The user is then asked to pick a seat or pick a price. They also have the opti...
[3 replies] Last: You can use cin >> int >> char >> int so that the two ints would rea... (by Bazzy)
append node to list
 
Please help me find out the error in this code Thank you #include <iostream> using namespace std; class Node { public: int data; ...
[3 replies] Last: thank, it worked (by Progesco)
reading from file problem
 
Hi, I have the following code to read two lines of a file and then put the data into variables of the object that called the function. void Artikel::read...
[1 reply] : What is m_pnaam? I don't see what could it be other than a char*, but... (by hamsterman)
non-local function...uses anonymous type
 
I have the following code: #include<cstdio> typedef struct{ int exp; }MyType ; void func(MyType a){ return; } int main(){ return(0); } W...
[4 replies] Last: The links help a lot. Thank you. (by lilydjwg)
Structures and Records
 
I am writing a program to be able to compare birthdays of 2 people to determine who is older. I need to use structures and records which i am very unfamiliar wi...
[3 replies] Last: Thank you! That helped so much. I am going to go give it a try and see... (by spazamatic2)
if statement problem
 
Hello, if (choice != choicea || choiceb) { do something } i would think this logic would work but it doesn't. The point of the app is to get a va...
[1 reply] : I'm no expert but I can diagnose some basic errors: You cannot just r... (by tummychow)
Same pointers but not same values
 
i have this in list class; public: obj_node * cur_x; void insert(obj_node * a, Object b) { obj_node * p = new obj_node; p->valu...
[no replies]
Adding characters to the front of strings
 
Hi Within my program, I need a string array to be 8 characters in length. The string, when input, is not necessarily 8 characters, and therefore i need to ad...
[5 replies] Last: Problem solved, thanks. (by TJohnston)
by Vit
Class variable problem
 
I've started working on a game. I'm pretty new to C++, but not to programming. Anyway, I have separate classes for characters and maps. I've defined the map cl...
[3 replies] Last: Yes, you could do that. Define the class in the header file and imple... (by Mike W)
word count
 
I'm writing code to keep track of every word in a file in a sorted list and how often it occurs, print out each word and how many times it occurs, total words, ...
[2 replies] Last: Please use [co de] tags (by Bazzy)
Sort object in a list
 
I want to write a function to sort object in a list (don't use STL at all), but I don't know how to use loop in this case. Please help me
[3 replies] Last: Elements can be swapped, given suitable iterators. (by kbw)
by robezy
Doubt about stack with head and tail pointers.
 
Hi, I have a stack with head and tail pointer. My destructor is as given below. Stack::~Stack() { while(head) { Ele...
[3 replies] Last: Classically, there are two major heap management errors. Not freeing ... (by kbw)
by DBarzo
Inherits from abstract classes
 
Soppose to have the following situation: class IBase { }; class IA : virtual public IBase { virtual void methodA() = 0; }; class IB { virtua...
[2 replies] Last: You're right! Thanks. Daniele. (by DBarzo)
by sam16
Open Directory and reading Files using C++
 
Hi I have C++ code to open the directory and read all the files in that directory. It works fine if i specify the absolute path but not working when i specify r...
[1 reply] : Probably either because the function can't accept a relative path, or ... (by Disch)
How to get time and date from system
 
Hey! Can someone tell me what function is for getting system time for my program? I found this: http://www.cplusplus.com/reference/clibrary/ctime/ bu...
[1 reply] : It is plenty of instructions and code examples http://www.cplusplus.c... (by Bazzy)
Can't fix this error...
 
I have a problem with my assignment originally it was working, but as I tried breaking the cmd line args into a second class it broke, so I put a method back in...
[2 replies] Last: ahh, thanks.. I took out the constructor args, forgot to delete the br... (by gcampton)
November 2009 Pages: 123456... 25
  Archived months: [oct2009] [dec2009]

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