Beginners - April 2022 (Page 5)

Help on this Lab
 
Write a program that repeatedly reads in integers until a negative integer is read. The program also keeps track of the largest integer that has been read so fa...
[2 replies] Last: What help is required? What don't you understand/am having a problem w... (by seeplus)
by Ganado
read a text file into a class
 
would it be possible to get the text file into the class format Are you saying you want to change the data inside the text file? It sounds you'd rather want t...
[1 reply] : Is this a homework assignment? Or work related? Because creating a se... (by Duthomhas)
How to save code to a .txt file over multiple sessions
 
I'm creating a program that will create a "company" profile (not actually used by companies), and the profiles will save to a .txt file, which works fine but Wh...
[2 replies] Last: 1. Make a struct (or class ) with all the information for a single ... (by Duthomhas)
inserting a class object into a map??
 
Hey yall, so we have an assignment dealing with maps, and I think I understand them, but I cannot get this one to work. I have a class (Apps) that contains a st...
[4 replies] Last: Thank you all for the responses, Ganado was very helpful but Peter87 h... (by dorito200)
Struggling with an infinite loop and a sub for global variables
 
I have 2 questions. My first program I am struggling with an infinite loop but I dont understand why, The second I dont know how to maintain the value of "wo...
[6 replies] Last: #include <iostream> using namespace std; void average(int , int); i... (by againtry)
File to a 2D array
 
I have a problem where i need to take different parts from a file and put it into a array. the file given has 28 rows and 5 columns, but i do not need two of...
[6 replies] Last: This can be simplified. Consider: #include <iostream> #include <str... (by seeplus)
dynamic parameter function
 
Hello @all Suppose I have a function struct s_input{ ... }; s_input in; void test(s_input *a, ...); I have a variable "num" (parameter o...
[8 replies] Last: I think jonnin's suggestion will work for purposes of printing (you wi... (by Ganado)
Create struct in header file and reuse it.
 
Hey, I'm writing a program which contains this map: const fifo_map<std::string, std::vector<int>> chords { {"maj", {0,4,7}}, ...
[8 replies] Last: ok thank you all, i understand now, someone else also pointed me to nl... (by wimvandenborre)
recursion error?
 
I made a code to check if a string is a palindrome. It works just fine for non-palindromes, but it outputs an error that goes along the line "terminate call aft...
[9 replies] Last: #include <iostream> #include <string> #include <string_view> #includ... (by seeplus)
what's wrong with my code?
 
Hi im trying to make a program to prime factorize a positive integer, but it doesnt seem to work. Can you help me find whats wrong with it? #include <cstdio>...
[16 replies] Last: @lastchance Omg that makes senseee thats why it didnt work beforeee ... (by sultan0104)
If Loops & Input From Data File
 
Hello all! I'm a beginner C++ student in her first class. I seem to be struggling with getting the code to read the file inside my folder. This is the code I ha...
[7 replies] Last: temporarily add this to the beginning of main() system("echo %CD%"); ... (by dhayden)
vector question
 
whats the difference between these std::vector<int *> tmp vs std::vector<int> *tmp?
[7 replies] Last: thanks for that. From time to time I have days where I just can't get... (by jonnin)
c-strings prog 7
 
Hello I am technically done with this project but I would like to get some feedback by someone more advanced. It does not compile right now because I ran out...
[5 replies] Last: An advantage of c-style strings is that for those that don't change th... (by seeplus)
Passing enum to a struct
 
Write your question here. enum class Operation { Add, Subtract, Multiply, Divide }; struct Calculator (Operation){ ...
[2 replies] Last: Thank you so much for this!!! (by eikkaaaaa)
Visual Studio C++ warning C4829: Possibly incorrect parameters to function main.
 
It has been a very long time since I wrote C++. I have the latest VS 2022 community installed. When I do my build, I get the warning " warning C4829: Possibly...
[3 replies] Last: Thanks for the responses. Like I said it has been a long time since I... (by DeepH2O)
1 % 0 and boolean values
 
This was our exam question. I said it will be 4th but IDEs say it's 2nd. How can second "if" be true? #include <iostream> using namespace std; int...
[7 replies] Last: I didn't hear about that "fact" while having a udemy course of Frank M... (by bydrachen)
by razzzz
Weird initialization of shared_ptr variable
 
Hi all, first of all, I hope the "beginners" forum is ok for this question, I'm not 100% sure. I'm trying to understand this fragment of code, which is part o...
[2 replies] Last: @Peter87 thank you very much for the thorough explanation! Things defi... (by razzzz)
Short way to add if statements to while loop.
 
Hey everyone, I'm lookin for a way to add statements to my while loop Now I have this: while (it.getNextEvent(currentMessage, samplePos)) Now i want ...
[6 replies] Last: it works! tx! (by wimvandenborre)
Lines of zeros when reading from file
 
I am trying to read the following information from a file called inputInventory.txt but i get a bunch of zeros when ran Im trying to get in this format shea ...
[4 replies] Last: #include <iostream> #include <fstream> #include <string> #include <... (by againtry)
by ice60
What C++ GUI framework should I use?
 
I have programmed C++ console applications as a hobby for the past year or so. My school took notice and asked me to create a program for a touchscreen TV in th...
[3 replies] Last: HTML and JavaScript. (by Manga)
April 2022 Pages: 1... 34567
  Archived months: [mar2022] [may2022]

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