Beginners - June 2021 (Page 3)

Any idea why this isn't iterating into the variables?
 
Keep coming up with 0 for output of all variables, not sure what I'm missing. #include <iostream> using namespace std; int main() { float occ_rat...
[2 replies] Last: Thank you, that fixed it (by itsrj1991)
by Kyang
Receiving out of range error
 
I'm receiving this error terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 18446744073709551...
[1 reply] : The error is telling you that i is out of range. Why are you using n... (by AbstractionAnon)
by Kyang
How to separate input into multiple vectors.
 
I'm working on an assignment for an online course. It requires me to take an input formatted like Tony Stark 90.25 and sort it into one vector for the name and ...
[2 replies] Last: That worked, thank you so much Ganado. I'm pretty new to this so I did... (by Kyang)
strange value of int in C++
 
Hello friends! I wrote a simple code and got output that I didn't understand the meaning of, somebody can explain it? #include <iostream> using namespace std;...
[2 replies] Last: Thank You! (by samikaner)
event handling for classes interfacing with hardware components
 
Hi all, I have a class that I have in mind to work as a high level interface to operate with buttons for embedded systems. I would like it to be reusable in ...
[3 replies] Last: Typically you'd have some kind of event id and some associated informa... (by kbw)
by alexas
ideas for rotation of multiple cuboids
 
Hello, I am asking such maybe more mathematical question here in this forum as it somehow gives me the best ideas in my project. I apologize if this is not ac...
[13 replies] Last: Well, you can try this code @alexas. It creates an STL image file ( st... (by lastchance)
Container not expensive
 
Hello everyone; I have a small question. I have an array like this :A=[7 8 5 9 10 5 11 12 5 10 11 12] . I need to find the index of 5 values in A and get the...
[7 replies] Last: the version without generating another vector B. Eh??? I don't unde... (by seeplus)
by y19177
unknown probelm
 
I recently replaced my hard drives and install win 10 pro. Now, I cannot even run the most simple C++ program on VS code. For example, run #include <...
[2 replies] Last: @jonnin Yes, this is a new installation. None of the methods mention... (by y19177)
by vboro
Reading data in from file?
 
Hi! I'd like to read in a simple row of integers from a .txt file and sort the numbers into an int array. The numbers are separated by space characters, like t...
[4 replies] Last: It worked!! Thank you very, very much :D (by vboro)
by saam
algorithms
 
How and which algorithms I can use to meet this requirements as I am a self leaner I need a help to write a pseudocode for it. thanks Devise your own setting f...
[6 replies] Last: @jonnin thank you very much (by saam)
What does a cpp main file should look like for embedded systems
 
Write your question here. Hi, I am puzzled as to what should be left in the main.cpp file in a well designed embedded program. For example, as of now, I have...
[4 replies] Last: If you're writing for a tiny device, like an Arduino with a 2k stack, ... (by kbw)
by min01
Hangman in C language
 
Can someone help me do this in C language? How do I put 7 chances for the player to guess? DIRECTIONS: Hangman Game Hangman is a game that let’s its player...
[9 replies] Last: Perhaps consider: Thank you so much for this, I didn't know I can j... (by min01)
passing vector class to function
 
I have used a vector class inside a function like below to get every object in that class. std::vector<ClassName>student_detail(size); Now I want to...
[6 replies] Last: I didn't know about "rule of 0" https://en.cppreference.com/w/cpp/la... (by George P)
how to merge 2 sorted arrays from 2 files into 1 file
 
Hi, can someone help me with the idea on how to merge 2 sorted array from 2 text files into 1 text files that contains all sorted element.with the complexity of...
[3 replies] Last: Another way to sort the data of two files that look to be composed of ... (by George P)
functions not working :(
 
So I'm working with functions, and I'm building a conversion program. The conversions are fahrenheit to celsius, miles to kilometers, and liters to gallons. Eac...
[3 replies] Last: #include <iostream> #include <iomanip> void displayMenu(); double fa... (by George P)
Return 0 doesn't make any change in my program.
 
I was learning C++, and I saw that return 0 indicates main function ran successfully. And non-zero return statements indicate that my program didn't run success...
[15 replies] Last: what does successfully run and not successfully run mean tho? You, ... (by Ganado)
Return NULL in C++
 
Hello, I'd like to if a book not find, the below method(findBookByAuthorName) return NULL. or do you have a better idea? Thanks class books { book* myBook...
[5 replies] Last: To return a pointer you'd do: book * findBookByAuthorName(string nam... (by dhayden)
new to functions, decimal gets truncated off the final grade, and for why?
 
I'm supposed to write a program that uses different functions to take the scores of two tests and a homework and convert that into a letter grade. There is 'cal...
[4 replies] Last: Hello morganniie, In addition to what Furry Guy has said a few blan... (by Handy Andy)
no operator "=" matches these operands
 
i keep going in circles with this lol. i need to create an if else loop, but the if statement is comparing the users input to a randomised line from a file, I'v...
[9 replies] Last: that worked perfectly. thank you very much (by JackLadYT)
by sarvcr
Adding objects with a loop
 
Hi! I'm coding a program where I have to classes: Libro and ColeccionLibros. I want the class Libro to create the object and then the class ColeccionLibros to s...
[1 reply] : This seems to work. #include <iostream> #include <sstream> using nam... (by salem c)
June 2021 Pages: 12345... 9
  Archived months: [may2021] [jul2021]

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