General C++ Programming - June 2013 (Page 2)

Printing from file one word at a time.
 
I have done an exercise from "Thinking in C++" to print text from a file to the console one line at a time, with the user pressing enter to get the next line. ...
[4 replies] Last: Works better now thanks. (by closed account j8CjE3v7)
How to write code for this question
 
QUESTION 1 Write a C program to enter an initial number of population and its projected population. Assume the population will increase in the same percentag...
[1 reply] : benchmark look like this : Maybe can become our benchmark when testing... (by Blacklist1315)
by nmn
"cout" side affect ?
 
Thanks for reading... the below code works fine (not the most efficient, i am new to c++), but as soon as one of the lines containing "cout" is removed, the ca...
[2 replies] Last: Thanks ne555....you were right (by nmn)
Virtual base classes size of
 
Tested on VS2012 Sp1 struct C{ virtual void f(){} C(){} }; struct C1:virtual C{ virtual void f(){} virtual void f1(){} C1(){} //commenting out ...
[11 replies] Last: My best guess is that VS2012 does not need these 4 bytes , other compi... (by fairshadow)
How do you print to console the contents of a file using foreground colors and other attributes?
 
Suppose I have a txt file that I want the contents printed to the console in such a way that every five words are colored blue and the following five are red. H...
[1 reply] : C++ doesn't know anything about consoles. That's an OS-specific thing.... (by Duthomhas)
Weird way to print array
 
I was helping someone else on this forum, and made a mistake in my for loop, but to my amazement, it still printed out the array. Could someone explain WHY th...
[7 replies] Last: No one will like you if you do. Just remember this. Wow. I guess ... (by whitenite1)
Code::Blocks not recognizing extern "C" blocks
 
Hi, LeafyCircuits here! Comp specs: OS: Windows 7 Home Premium 64-bit Compiler: MinGW 4.6.2 IDE: Code::Blocks 12.11 Apparently, Code::Blocks doesn't recognize...
[5 replies] Last: Actually, never mind. I tried amhndu's code, and I do have __cpluspl... (by LeafyCircuits)
by Exiled
Camera Mouse Movement - OpenGL, Allegro 5
 
Hey everyone; currently I'm programming a first person game using Allegro 5 and OpenGL. Right now, I'm doing mouse movement basically by checking the mouse pos...
[no replies]
TERM Environment Variable error?
 
Hi guys, So I have been working on a Game of Life code the past few days and I have come to something that I am hoping will work. I tried to run it and I am ...
[5 replies] Last: This should be a linux question. What distribution are you on? One te... (by Vidminas)
C++ casting
 
Hello people. I know C++ treats something like int(5)/int(10)=0 To see the result 0.5 it's necessary do use static_cast<type>, is that right? How can I use t...
[3 replies] Last: Thank you to the answers, helped a lot! :) (by goncalves)
string array
 
i am working on a ticktacktoe game for a while. I code it with 9 string first but i decided to re code it using 2 dimensional array.But i need to use it as stri...
[no replies]
Operator overloading
 
I am getting an error and I have no idea why, I think it pertains to my cin statement but cannont figure out what is going on exactly. Can anyone help? #...
[1 reply] : Ah nevermind, I figured it out, missed the reference in the cpp file!! (by yoked88)
by a k n
C/C++ dynamic memory deallocation mechanism
 
Hi, In c/c++ we allocate dynamic memory using malloc()/new() and deallocate using free()/delete(). If we manually create it we must manually call the dealloc...
[7 replies] Last: Glad we could help :) This stuff isn't always obvious, and it's not o... (by MikeyBoy)
by siag
Adding a big number into array
 
hello when i run the program i want to add a big integer number into an int array how can i do it.i don't want to use for loop Thank you
[4 replies] Last: Thanks (by siag)
need help with my c++ program :-(
 
I need a program with menu system and program should ask for student surname, forename and their date of birth.the program should not accept the student bellow ...
[4 replies] Last: You learn by your misstakes. So try and write the code and see where ... (by ajh32)
by minak
thread
 
hi, I am trying to use multithreading for fuction which is identified in the class, but I confront to this error: error C2664: '_beginthread' : cannot convert p...
[1 reply] : The error indicates that you're attempting to call a function that exp... (by Cubbi)
by Rikkin
Problem: Dynamic memory allocation
 
Hi guys, I'm new in C/C++ programming and I got a problem in dynamic memory allocation. I have a program that reads a file, than do some calculations. Than m...
[3 replies] Last: In C++, use the new operator and not malloc . // float *x = (flo... (by nkendra)
Queue
 
/* Implementation of a circular queue of Array containg names.. */ # include <stdio.h> # include <conio.h> # include <stdlib.h> # include <string.h> # define ...
[2 replies] Last: i'm not a very good coder. i'm really really a newbie. forgive me but ... (by EJ Destua)
Visual Studio Express C++ 2010
 
Ok guys I have a slight problem in Visual Studio C++. I have a Combo Box with four options : Construction Project,Research Project,Business Project,Accounti...
[1 reply] : Firstly, you should have really put this in the "Windows Programming"... (by ajh32)
Best type for text in Win32 API
 
Hi I'm having real problems with lines of text, getting 'can't convert errors' when passing text to SendMessage functions and problems with converting when p...
[7 replies] Last: I don't know why but it works when I do it all in 'LRESULT CALLBACK Wn... (by Bosskardo)
June 2013 Pages: 1234... 28
  Archived months: [may2013] [jul2013]

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