General C++ Programming - July 2022 (Page 3)

by frek
The type of sting literals (1,2)
What is the type of string literals, say, "Hello", in C++, please? Is it a const char* as Stroustrup says in the book Tour of C++ or is it an array of cons...
Jul 9, 2022 at 4:34pm
[22 replies] Last: and also: auto str {"hello"sv}; where str becomes a std::string_... (by seeplus)
by zsess
How do I get this to only output the userinput that it finds.
#include <iostream> #include <string> // Note: This library is needed to use the string type using namespace std; int main() { string userInput; cout ...
Jul 9, 2022 at 4:22pm
[4 replies] Last: Using arrays, then possibly something like this - where it is easier t... (by seeplus)
by ruzip
Looking for a LoadLibrary C example that works with GCC
So far I found this: http://www.sharetechnote.com/html/C_LoadLibrary.html Removed stdafx.h Added #include "tchar.h" it compiles fine, but throws a note and...
Jul 9, 2022 at 9:19am
[3 replies] Last: LoadLibraryA means you're compiling as ASCII and not unicode. Hence st... (by seeplus)
by ruzip
Linking FreeGlut Static Library to DLL
Basically I would like to link FreeGlut static library and include it in my project DLL. I'm getting some undefined references as the linker seems to look for ...
Jul 8, 2022 at 12:17pm
[4 replies] Last: Ok thanks kigar64551 , will try the trace option. (by ruzip)
by ruzip
Using Static C++ Library in C
I'm having problems linking a static C++ library in C. I have already done it with shared library and dynamic linking using a wrapper library.. libCPP.a ⟵...
Jul 7, 2022 at 10:28pm
[10 replies] Last: Keep in mind that programs like gcc and g++ are so-called "drivers... (by kigar64551)
Copying from txt file to parallel arrays using pointer
I am trying to use parallel arrays to store cards information . Firstly use a function that reads all cards information from a text file and insert them to para...
Jul 7, 2022 at 4:19pm
[8 replies] Last: Maybe something like this: #include <iostream> #include <fstream> #... (by seeplus)
How to split a string according to "|"
hello everyone, I have a problem with split in c++11,this is my code in main: string str = "AAAAA|BBBBB|CCCCC"; vector<string> vec = s_split(str,"|"); f...
Jul 6, 2022 at 3:44pm
[5 replies] Last: Using C++20 ranges: #include <vector> #include <ranges> #include <i... (by seeplus)
Prj Hlp
Hello This is the code that I've addressed last time and I made a new one and made a new code and currently working on it. This is my concern When you input 6 i...
Jul 6, 2022 at 12:10pm
[4 replies] Last: Part 3: int main() { movieList movie; movie.OpenMovieFile(); mo... (by seeplus)
by BigBen
Saving a vector of objects
I have a vector of objects of a class. It is a class with a large number of different types of member variables and functions. I want to save this vector of ...
Jul 5, 2022 at 3:56pm
[3 replies] Last: As others have said, your problem is mostly about how to write (read) ... (by keskiverto)
how does the program get to the next line or next char? ?
Hi, how does getline reads the 2nd line if getline function is called again since it doesn't have a '\n' to skip to the next line. 2nd question does the prog...
Jul 5, 2022 at 3:53am
[2 replies] Last: > how does getline reads the 2nd line if getline function is called a... (by JLBorges)
Project Help
Hello I've been working in the code and I need to modify the code below My concern are the following: - Check Video Availability = when you input 6 in th...
Jul 4, 2022 at 1:34pm
[6 replies] Last: okay tnx for that. I'll try to work on it. (by closed account 3RGNvqkS)
by frek
Determine whether a triangle can be built from a given set of edges
Here's the task: https://app.codility.com/programmers/lessons/6-sorting/triangle/ And here's a simple O(n log n) solution for it (what the site expects): int ...
Jul 4, 2022 at 7:49am
[9 replies] Last: @Duthomhas You mean applying a non-comparison sort algorithm for both ... (by frek)
need assistance! Write a program that reads students’ names followed by their test scores.
Been having a lot of bugs with this code and can't really figure out why. Any help would be appreciated. Instructions Write a program that reads students...
Jul 3, 2022 at 6:34pm
[4 replies] Last: https://stackoverflow.com/questions/1452721/why-is-using-namespace-std... (by deleted account xyzzy)
by ruzip
Encode integer value to 4 bytes in a file
I'm trying to encode data into a file in binary mode. It should be 4 bytes with an integer value. Say the value is 5, when opened in a hex editor the file sh...
Jul 3, 2022 at 1:48am
[7 replies] Last: It's not usually necessary to test your machine's byte order, because ... (by mbozzi)
My program keeps getting zero as an answer
I am writing a program as homework that gets input from the user for the calories in a food and the grams of fat, then calculates the percentage of calories fro...
Jul 3, 2022 at 12:27am
[1 reply] : [quote=lexicution17]I keep getting 0 as an answer for the percentage ... (by deleted account xyzzy)
Need assistance with this code please!!
Instructions: The history teacher at your school needs help in grading a True/False test. The students’ IDs and test answers are stored in a file. The first e...
Jul 2, 2022 at 10:53am
[7 replies] Last: we're not allowed to use strings like you use, we have to use chars ... (by seeplus)
by ruzip
Change Insertion Operator Symbol by Macro?
Hi, I would like something like: cout "Hello " + mystr + ".\n"; instead of the standard << symbol.. cout << "Hello " << mystr << ".\n"; Is this possi...
Jul 1, 2022 at 10:40pm
[14 replies] Last: The term POD is no longer used by the standard, and its type traits (... (by Duthomhas)
by t im
About the cmp in priority_queue
I want to define the cmp in priority_queue by myself, the code is as follows: auto cmp = (const ListNode* a, const ListNode* b) { return a->val > b->v...
Jul 1, 2022 at 8:07am
[1 reply] : > Why should I use decltype(cmp) The type of cmp - the closure typ... (by JLBorges)
July 2022 Pages: 123
  Archived months: [jun2022] [aug2022]

This is an archived page. To post a new message, go to the current page.
Registered users can post in this forum.