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 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()...
[1 reply] : The compiler must know the return type of when compiling the function ... (by Peter87)
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)
by Atom1
DLL Calculation does not agree with Excel (1,2)
 
I'm trying to understand why the DLL built from the code below does not get the same result as Excel. In Excel I get: 0.892857143 From the DLL I get: 0.904762 ...
[20 replies] Last: Array Values Old Method DLL 848 5 4516.72552 0.9981800000 ............ (by lastchance)
by chipp
C++20 import issue
 
i tried to code in C++20 and tried to import header file but it doesn't worked anyone knows why? IDE i'm using is Visual Studio 2022 my code is like th...
[7 replies] Last: but there's no "Latest" option Look at the option below C++20, the o... (by George P)
make_pair with explicit types
 
Good day! I have problem understanding why my example is not compiling when I explicitly specify the types for make_pair. #include <string> int main()...
[7 replies] Last: Thank you for answers! It became a lot more clear now! @Peter87, Abou... (by Satoshi Yoda)
by Ch1156
Best way to lock a thread mutex?
 
So if I wanted to lock a mutex, could use mut.lock() and mut.unlock(), but the more modern way to do it is to use std::lock_guard<std::mutex> lock(myMutex);, bu...
[3 replies] Last: Awesome thank you both! (by Ch1156)
by Ch1156
Re-validating an iterator (1,2)
 
I wrote a simple program that removes all people from the vector based on age. Normally, when i write a program like this i usually remove only one person, so i...
[25 replies] Last: Thanks for all the info, ill set that up at some point here soon. For ... (by Ch1156)
by Atom1
DLL is not a valid win32 aplication
 
I recently migrated from VS 2019 to VS 2022. When I try to run debug on this code, I get a message box saying dll is not a valid win32 application. I can build ...
[8 replies] Last: Also just a small point. if you want to debug a dll then the dll needs... (by seeplus)
got undefined symbol: _ZTIN9... when run executive file
 
Hello everyone! This morning I have got unexpected error: "undefined symbol: _ZTIN9Fastcgipp3SQL12Results_baseE" when I run the executive file. The program was...
[7 replies] Last: [quote=kigar64551]But keep in mind... Thank you. btw, I hope there w... (by spistol)
Output Iterators: What does it mean that "we may assign to a given value of an output iterator only once"?
 
From C++ Primer, Lippman, Section 10.5.1. "The Five Iterator Categories" Output Iterators can be thought of as having complementary functionality to input ite...
[1 reply] : > 1. What does it mean when the author says "we may assign to a given ... (by JLBorges)
C++ GUI QT (Trafic Light)
 
I have to write a GUI application for Traffic light - Green/Yellow/Red im allowed to specify the time interval once on the GUI for the colors and it should not ...
[10 replies] Last: Use a QVBoxLayout ? https://doc.qt.io/qt-6/qvboxlayout.html#details... (by kigar64551)
How to write a class that can be written out to ostream_iterator and read from istream_iterator?
 
I'm reading C++ Primer, Lippman, the chapter on stream iterators and in particular on istream and ostream iterators. For istream iterators: [quote=Lippman]An...
[10 replies] Last: > Can I specify specific input stream types instead of istream& operat... (by JLBorges)
by Feit
Producing a specific pattern
 
I am trying to produce a specific pattern (shown below) using C programming. I wrote the following code, that does not produce the same output. Would anyone ple...
[3 replies] Last: Many thanks. (by Feit)
How to use extern to refer to an external variable with the same name as variable declared statically?
 
In the function increment() below, how do I refer to sameName from file2.cpp? main.cpp #include <iostream> #include <string> using std::cout; us...
[3 replies] Last: [quote=JLBorges]This violates ODR I see. I just wanted to understand... (by ElusiveTau)
Why CMake doesn't see -std=c++20?
 
Hi there! I'm trying to install an library. After the "make" command, there are a lot of errors regarding std::chrono. As I see it, it is related to the c++20 ...
[6 replies] Last: If cppreference is to be believed even GCC 13 is not 100% compliant wi... (by George P)
user adds vector
 
Anyone know a good method for letting a user add a new vector and access all vectors created...in a menu? I do not have any functional code to post. Any help wi...
[4 replies] Last: As a starter for 10, consider: #include <map> #include <vector> #in... (by seeplus)
Back Up Microsoft Visual Sudio Project? (1,2)
 
Hi, Sorry if this is the wrong forum... I am using Microsoft Visual Studio 2019 and would like to know how to make a backup of my project. I need to re-in...
[22 replies] Last: Another way to backup code: Use a NAS (Networked Attached Storage). I ... (by ElusiveTau)
by Ch1156
Does this code look fine
 
Ive been practicing with using iterators with vectors, vectors of pairs and maps, this happens to be a vector of pairs but it thought i would get it looked at s...
[3 replies] Last: Compare offers a potential use-case for range projections. Could be... (by mbozzi)
  Archived months: [aug2023]