Beginners

by admin
Welcome -- read before posting!
 
Welcome to the beginner's forum in C++.com! In this forum, users can to talk about any topic related to C++ for non-expert audiences. Feel free to participate...
[2 replies] Last: How To Answer Questions in a Helpful Way Be gentle. Problem-relat... (by admin)
Console Closing Down (1,2,3,4,5,6,7)
 
Hi, i am new to C++ and have just written my "Hello World" program. It worked all right but the console/cmd closes down instantly. If you tell me why it is clos...
[120 replies] Last: It displayed "Hello world" after you pressed Enter. int c is a ... (by Duthomhas)
by demhat
what can I do?
 
what does the word 'branch' mean in computer language? I am studying C/C++ from a book and the book wants me to make a program which is called 'build your ow...
[4 replies] Last: thank you guys (by demhat)
projects and files tracker
 
Hi folks, I am trying to find a simple and robust software tool to track my projects and files on Linux (Ubuntu) I am using git, but I am interested in t...
[7 replies] Last: Markdown editors available for Linux: https://itsfoss.com/best-markdo... (by George P)
by dialer
!(f=fopen()) ?
 
Why do we need to use 'f=' when opening a file in this if statement? I should preface I have a variable on top called FILE *f=stdin; else if( ...
[5 replies] Last: [quote=dialer]so you are saying if we want to do f.close() in the futu... (by keskiverto)
swapping arguments and erros
 
Hello, In the program below, I have three questions Question 1: If I swap the arguments in inputValidate function i.e., instead of: int inputValidate( i...
[3 replies] Last: Code like: int winning_numbers = func( winning_numbers ); makes one ... (by keskiverto)
Help with text-based fighting game health bar
 
Ok so I've been messing with this all morning, and I fix one output and just break the others. I need this to end in 2 ways: player wins: HURRICANE KICK (...
[4 replies] Last: Consider: #include <iostream> #include <limits> using namespace std... (by seeplus)
I do not want to send my source file
 
I am using visual studio 2008. I want to share my program with others, but I do not want to send my source file. What file should I send and where can I find ...
[4 replies] Last: Nope, .NET has no such thing as "static" builds. The EXE files (ass... (by kigar64551)
by dialer
while(argc--,argv++) // c related question
 
this is more of a C related programming question . . . What would the following statement do? Does it loop through the first argument and corresponding argumen...
[7 replies] Last: As argv is a memory pointer this is effectively an infinite loop and... (by kigar64551)
Overloading operator<< for template instantiations: CRTP: error C2995: ... function template has already been defined
 
Say you want to define a class template, Foo<T> , whose instantiations: 1. have a string representation 2. define operator<< so that it can be directed to...
[2 replies] Last: Thanks for the clarification, mbozzi. You're right - I didn't correctl... (by ElusiveTau)
by Atom1
API Entry DllMain
 
Can someone explain, in layman's terms, what the purpose of the code below is. Is it required for the DLL to work properly? BOOL APIENTRY DllMain(HANDLE hM...
[3 replies] Last: Thank you for the comments. (by Atom1)
SDL generating sound without wav file
 
I am trying to Mix_LoadWAV_RW to play sound via SDL_RWops* rw, so not playing back a wav-file. Is the following approach the right one? A buffer from a ofstream...
[3 replies] Last: Here's an example that generates a 10-second long wave-file containing... (by mbozzi)
by Ganado
Initialize set based on field within array's class
 
Let's say I have code like this: #include <iostream> #include <numeric> #include <algorithm> #include <set> #include <iterator> enum Bar { A = 5...
[7 replies] Last: With C++11 we could already say std::transform(std::begin(bar_arr), s... (by mbozzi)
by Ch1156
Factory Class Pattern
 
Is this how you do a factory pattern? Im curious to learn since it will make my design a little easier to scale. My code is still a work in progress but I just ...
[3 replies] Last: Typically, a factory comes in play when you have inheritance and the o... (by longberns)
by demhat
EOF-unwanted loop!!!
 
The problem is that I want the first loop to be countered but the second with the sentinel value 'EOF' I wrote the program like this. However, when I entered Ct...
[11 replies] Last: Would have been a better choice. In c for the purpose of array size... (by seeplus)
SDL2 mixer error
 
When trying to load a wav-file to the mixer of SDL I get an error: undefined reference to `Mix_LoadWAV'. Also, Mix_OpenAudio is complaining that it has too many...
[2 replies] Last: As pointed out before, "error: undefined reference to XYZ" is a lin... (by kigar64551)
by Allaye
cant call a template function with auto return type in main
 
#include "iostream" #include "string" using std::cout, std::cin, std::endl, std::string; template <typename T, typename U> auto max(T x, U y); int main()...
[6 replies] Last: Putting code tags on the OP's code, as well as a bit of judicious refo... (by George P)
XAudio2
 
When initializing xAudio2 in Eclipse there comes an error: undefined reference to `XAudio2Create'. IXAudio2* pXAudio2 = nullptr; if (FAILED(hr = XAud...
[1 reply] : Sound like a linker error. Probably you did not link the required im... (by kigar64551)
codeblocks debugging help
 
Hi. Can you assist me with issues of debugging cpp code in codeblocks on Ubuntu?
[no replies]
How to display the number of elements in a dynamic memory allocated array
 
Hi, Please, can someone help with this code? I have been trying to display the number of elements store in a dynamic memory allocated 1D array created using ...
[15 replies] Last: @All Awesome! I learned so much from this interaction especially abou... (by ayoesquire)
  Archived months: [oct2023]