Beginners - July 2010 (Page 14)

getline
 
Hello, i've used getline several times in my code witout any problems, but for some reason when i step through my code to the line below with in the IDE it do...
[3 replies] Last: Thanks guys, that did the trick. (by Mike200)
Unable to pass correct class pointer
 
I am currently working on a small game manager for my young nephews games, mainly as a project for me to learn C++. It involves him inputting when he wants...
[10 replies] Last: You are trying to push a std::string onto a People* vector. You need t... (by Galik)
Addition of two matrices
 
I have many errors in the following code.Could you suggest a better way to overload '+' in this class.My way doesn't work at all.The other functions are nicely ...
[6 replies] Last: Only the last element of the array is added: class matrix { publ... (by manasij7479)
Switch error
 
I'm using the following code in my program to exit, save, and stop/start but i get an error saying "Transfer of control bypasses initialization of." Why is it d...
[6 replies] Last: tq jammas..but i did'nt really understand..huhuhuhu i'm sorry.. (by afiqah)
by Suzie
convert a variable
 
Hi to all. Im very new to any sort of programing, so please dont laugh at my naivity. I have some code that returns a long type variable. Another part of t...
[10 replies] Last: [quote=Suzie]m4ster r0shi sugar Stop it... I'm blushing... (by m4ster r0shi)
Sig Error: Testing out a matrix class
 
*sigh* I'm stumped. I'm attempting some practise problems to get familiar with classes, but I keep getting this annoying Sig error, and then my console freezes ...
[6 replies] Last: Oh Ok, I think I get it. The copy constructor is only used to initiate... (by sonic1015)
Optimisation
 
Hi every one! I've wrote this (see code below), and i have some questions: * is this code safe and even useful? * how can i rewrite this code so that i j...
[8 replies] Last: It is also a violation of the standard to call main. ! Didn't kno... (by firedraco)
by michy
virtual function
 
hi, its me again =D... about virtual function, all i know is: class A{ virtual void display(){ cout<<"AA"<<endl; } }; class B:public A{ virtual void ...
[1 reply] : Yes. It's the type of object the pointer points too (class B), not ... (by binarybob350)
by michy
operator overloading
 
hi folks, today i meet a new problem again... =) about operator overloading, as i know: student operator+(student a){ this.marks = this.marks + a.marks; ...
[7 replies] Last: Also, remember that rhs is const , so your (point) + operator shoul... (by Duthomhas)
static object
 
Dear Experts, what is the purpose of declaring a C++ object as static. when to declare an object as static. Please provide a simple example along with expl...
[8 replies] Last: thanks alot for the information.... appreciate it (by michy)
clock
 
hello i'm trying to make a digital clock. but when i compile i get this error: [Link error] undefined reference to 'WinMain@16' Id returned 1 exit status ...
[1 reply] : Your project is set for windows application you need to change it to c... (by binarybob350)
Expression: vector subscript out of range
 
I'm curious why if i want to do this with vector(which holds strings) if(vec =="0") ... Error prompt appers. Program: *** line; #include "stdafx.h...
[3 replies] Last: It should be if (i==0) { ... The semicolon at the end is wrong. Also,... (by Athar)
taking input from a file
 
I have a file with the following data(each data type separated by a tab space) file name: test1.txt start- supercontig10.2 supercontig10.2 2344 2 232 2...
[1 reply] : For reading in the first two parts, you could use an std::string. If ... (by firedraco)
New operator
 
Hi, When I run following program... using namespace std; int main() { int *p =new int; *p =7; cout<<p<<endl; delete p; ...
[1 reply] : delete p; doesn't change the pointer in any way, it only releases the ... (by Athar)
why wont you work?!
 
this code is intended to print out an amount entered for a check into words. however, when a user types something like "19" as the amount, this is what displays...
[1 reply] : The problems lie in the 'display words' section. cout << textnum <<... (by hamsterman)
Memory management and std::vector.erase()
 
I'm trying to use std::vector to hold a 'PhysObj' class to be used in physical simulation. My visible objects in the scene have a 'PhysObj' member pointer, a...
[no replies]
by Wander
Multi-dimensional Array
 
Hey, I'm trying to create a program that holds map coordinates and allows the user to pin-point certain locations. I created a multi-dimensional array, but t...
[3 replies] Last: See: http://www.cplusplus.com/doc/tutorial/dynamic/ (by firedraco)
by EEmsu
Using eof() function displays numbers twice?
 
I have a text file with the numbers: 256 314.654 When I run my program it displays: 256 314.654 256 314.654 why is it displaying the numbers twice? ...
[2 replies] Last: Because eof is only set when you try to read beyond the end of file ... (by guestgulkan)
SDL Trouble
 
I'm not sure if it's appropriate to post SDL problems here but I thought I'd try. I don't know much about SDL but I'm trying to simply blit something on the scr...
[6 replies] Last: Just flush it, that's what std::flush is for. Opening/closing files l... (by firedraco)
arguments to main()
 
I have a header file & implementation file called by a file containing my main function. Once I build and run my main function, I want the user to call the exec...
[8 replies] Last: Yes... I was wondering if jsmith would pop up with a link like this...... (by m4ster r0shi)
July 2010 Pages: 1... 1213141516... 31
  Archived months: [jun2010] [aug2010]

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