General C++ Programming - September 2011 (Page 21)

by else87
Trouble with a Calculator I just finished.
 
The program works fine until you access case 7: on line 64. Once you do that, no matter what you input into the program, it quits. //***CALCULATOR*** #inclu...
[6 replies] Last: Even though this post may be solved i need to point 1 small thing: DO... (by eraggo)
MinGW C++0x - problem with array initialization
 
Technically, this should be legal in C++11(0x), and initializer lists are supposedly supported since GCC 4.4 (I'm using MinGW 4.5.2) - yet I am getting an error...
[2 replies] Last: Nah that's not it. The syntax is correct, the exact same thing works, ... (by hanst99)
by aj3423
compile error extending std list
 
#include <list> using namespace std; template<typename T> class mylist : public list<T> { typedef list<T> super; public: void my_pop_front() { ...
[3 replies] Last: oh, I got it Thanks~ (by aj3423)
C++ segmentation falut <core dumped>
 
Hi, I'm a beginners of C++, and I've found something weird error called Segmentation falut <core dumped>. I can't understand why my codes keep making this error...
[2 replies] Last: Using the mighty gdb, I find this: #0 0x0804880b in john_linked_5::... (by Moschops)
Same Typely Funcs Definition
 
#include <iostream> #include <typeinfo> using namespace std; int add(){ int a,b; a=25; b=35; return (a+b); } (typeid(add...
[4 replies] Last: Not really. helios version is better suited in most cases, my version ... (by hanst99)
How does one convert a C++ code into a graphical application
 
Hi everyone, i've been studying C++ for quite some time now but i still don't understand how one converts a C++ source code into a fully-functional graphical so...
[5 replies] Last: I think the question was how to introduce GUI code into your applicati... (by hanst99)
Multiple "if" conditions?
 
Is it possible to have more than one condition in one "if" statement? I read somewhere online that using "|" like this: if (x == 7 | 8 | 9) { action } ...
[2 replies] Last: Many thanks. (by closed account 967L1hU5)
Is it possible to copy a temporary class instance of itself into itself?
 
I have several bool validation methods in a class that will set data if it is valid, otherwise it does not change anything and returns false. I need to write...
[8 replies] Last: chenqi07, thanks for finding that error for me. When I went to fix it... (by IceThatJaw)
Pthread Qns on Mutex
 
i have a question regarding pthreads. If i have the following code: pthread_mutex_lock(&mutexT1) DO_Something_A pthread_mutex_unlock(&mutexT1); Ove...
[4 replies] Last: hi thanks for ur reply. in fact, my '2 resources' are indented to be a... (by diskhub)
Need Reassurance
 
With the new version of c++ (c++11) coming out, I'm kind of worried that I'll be confused if I continue learning. So my question is, will there be major chan...
[2 replies] Last: OK, thanks that's one less thing I have to worry about now as I learn (by TheFlow450)
by Ideka
Checking whether an object is an instance of a class or its subclasses (1,2)
 
Consider the following pseudo-code: #include <iostream> #include <vector> using namespace std; class A { public: A() {}; virtual void foo() ...
[22 replies] Last: I just want my engine to take care of more stuff. E.g. the main loop. (by Ideka)
Reading Text File without spaces
 
I have problem regarding reading string without spaces. For example: the input text file is this. int a; a = 1+2; the output should be like this. ...
[2 replies] Last: Thank you so much! Btw, what is the real function of FSM? Im sorry, ne... (by lorrainecarla)
C++ program needed!!
 
Hi, I need a C++ program that includes a 'for' loop, 'if' condition, inheritance, constructors, structures, arrays, classes. I need it for my school project. Ev...
[4 replies] Last: You missed a semi-colon after the $ class definition. But, besides tha... (by shacktar)
by Jagman
Need if statement help with a string variable
 
I am trying to make a program that asks for an answer that is a string, however I cannot make it recognize the correct answer. Any help would be appreciated. ...
[2 replies] Last: Ah i see, that helps a ton! thank you very much! (by Jagman)
Help in A timer in C++
 
I was making a Quiz in the Console. I decided to add an Timer in that runs in the background, and gives the user the Time they took at the end. This is th...
[8 replies] Last: #include "windows.h" DWORD startTime; int main() { star... (by tolga gerekci)
Unable to print to a txt file while inside a loop
 
Hey everyone, I want to print data to a txt file using a void function outside the main. The problem is that it only prints the last iteration of the loop cal...
[2 replies] Last: THANKYOU, THANKYOU, THANKYOU (by gibran5876)
a question about ln(x) and math.h
 
hi everyone! i'm trying to write an algorithm that approximates ln(x),and i just can't come up with a decent one...can u please tell me how to do that,or how l...
[10 replies] Last: aw.right.thx dude! (by MasterAsh)
Program should be updating but isn't?
 
#include <iostream> #include <windows.h> #include <conio.h> using namespace std; void GameLoop(); int main() { char key = ' '; HANDLE hConsole; h...
[5 replies] Last: huh, when I compiled it, it ran. int main() { char key = '... (by closed account zwA4jE8b)
pass-by-reference to function vs. to function template
 
This code does not compile: void f(const int& val) {...} int main() { f(1); return 0; } but this is correct (why?): template <typename T...
[9 replies] Last: I was doing some reading and came across this Only the address of th... (by closed account zwA4jE8b)
by ArpitJ
c++ pointers & arrays
 
#include <stdio.h> #include <stdlib.h> #include <iostream> using namespace std; int width = 100; int height = 100; float cam = {-1.1,-1.0,1.2}; floa...
[2 replies] Last: Your functions are returning a pointer to an array which is local to t... (by closed account D80DSL3A)
September 2011 Pages: 1... 1920212223... 31
  Archived months: [aug2011] [oct2011]

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