Beginners - June 2019 (Page 2)

string::substr tutorial needs range added
This is an example from a tutorial for string::substr. Please change it so that the definition of 'pos' is now "but" plus 2 words before it and 2 words after it...
Jun 28, 2019 at 3:56pm
[3 replies] Last: This can't match @JLBorges', which is superbly efficient. However, her... (by lastchance)
scope of double nested for loop
Hi, I am a little confused about the scope of double nested loops. int i = 0; while (i < tot){ for (int j = 0; j < found; j++){ ...
Jun 28, 2019 at 2:37pm
[5 replies] Last: Consider me well schooled! =) Turns out, my intended question was bei... (by jjordan33)
I need HELP with C++ and Arduino
I have to create a program where I need to send numbers from a text file to an Arduino UNO through a C++ program. But once I've managed to open the .txt files a...
Jun 28, 2019 at 4:08am
[1 reply] : Which OS/Compiler are you running on the host machine. The one with th... (by salem c)
Trying to figure out rand()
Hi, Is the following code correct if I want to create a random number -RanNum - between 1 and 100 and convert it and store it into a string -s-? ...
Jun 27, 2019 at 6:10pm
[3 replies] Last: If you're just printing a number, you don't need to convert it to a st... (by Ganado)
prime numbers (1,2)
this code is supposed to iterate through all consecutive numbers from 2 to 100 and should print all the prime numbers. What I get is instead a long list of repe...
Jun 27, 2019 at 4:25pm
[22 replies] Last: Don't sweat it... the best way to check isprime() for small (meaning u... (by jonnin)
Comparing Values from external file
I am a beginner and this is a homework assignment, so I don't need full blown out answers! I know my code probably looks like a mess, so thank you for understan...
Jun 27, 2019 at 4:19pm
[5 replies] Last: it seems likely. perhaps something like getline from file (getline ... (by jonnin)
by mcclit
Storing multiple input inside a variable with out an array or vector.
Write a complete C++ program that reads in a list of scores until the user enters a negative number. It will add all the given scores up and subtract the bigges...
Jun 27, 2019 at 10:08am
[6 replies] Last: Don't forget to set firstTime to true. You can also use constructor t... (by Zaap)
by annw3y
c++ replace elements in linked list
Does someone know how to write a function that replaces the first one with the last element in a dynamic, one-way linked list.
Jun 27, 2019 at 6:29am
[1 reply] : template <typename Item> void replace_first_by_last( std::forward_li... (by nuderobmonkey)
by annw3y
c++
I need some help with some code. Here is the text: Plot the progress of the rider on the road. With the symbol * draw the number of percents by which a rider ha...
Jun 27, 2019 at 6:19am
[3 replies] Last: You've gotten your percentages. I assume that the "drawPath" function... (by zapshe)
Fastest way to read data into an vector?
Can someone tell me if there is a faster than this? My text file has 40 million lines, so basically I am storing 40 million strings into my vector. ifst...
Jun 26, 2019 at 10:10pm
[8 replies] Last: As others have already pointed out, there's a lot to consider with suc... (by Niccolo)
Add characters to a loop: C++
I want to be able to take my code and add A, B, C, D, E, F to each row, as so: 1A 1B 1C 1D 1E 1F 2A 2B 2C 2D 2E 2F 3A 3B ...
Jun 26, 2019 at 7:49pm
[2 replies] Last: Thank you. (by pwnsamp)
Can anybody suggest the solution in O(n)?
Two strings S and T of the same length N .Convert the string S into T by doing some operations. In an operation, you can delete the first character of the strin...
Jun 26, 2019 at 7:14pm
[9 replies] Last: It seems I misread the 'append' part... Sorry. :-( (by Duthomhas)
For loop question: C++
I have a code here that displays integers from 1-100 using 5 columns. I would like to know how to only display the numbers that are divisible by 6 and 7. For e...
Jun 26, 2019 at 6:15pm
[6 replies] Last: I meant XOR, and thanks, this solves it. (by pwnsamp)
derived classes
From article : protected members are accessible from other members of the same class (or from their "friends"), but also from members of their derived classes....
Jun 26, 2019 at 5:35pm
[1 reply] : A derived class = subclass = child class, in OOP. See also: https://ww... (by Ganado)
by medosz
While statement, two largest number
I wrote a program to find the largest number. This program use a while statement to prompt the user to enter 10 numbers. Then we get the largest number. What c...
Jun 26, 2019 at 2:28pm
[5 replies] Last: #include <iostream> #include <set> using namespace std; int main() {... (by anup30)
Other data types
1. What's the point of using union when we have struct?? In union we can't even know value of something because they share the same memories, but in struct we...
Jun 26, 2019 at 12:57pm
[7 replies] Last: Also use static to prevent the data from being created/deleted on ev... (by jonnin)
Question
Write your question here. Hello everyone. Question: Print the names of students who scored second lowest marks in a test. Encountering multiple problems(errors...
Jun 26, 2019 at 12:06pm
[3 replies] Last: Thanks Zaap, Salem c, everybody (by Beginner of C)
help much needed on TEMP assingment (ANY FEEDBACK IS GOOD FEEDBACK)
This assignment is pretty confusing just because it has a lot of steps and i'm pretty lost on what i'm doing wrong but i can not seem to get the correct code, a...
Jun 26, 2019 at 2:54am
[5 replies] Last: // The assignments wonky anyways just throw this at the teacher, sti... (by Shibitto)
The usual overloaded "<<" conundrum...
Ok Gang, Mr. Dummy (myself!! LOL) is back with another problem that you would all THINK is easy (I hope it is) but I'm screwing something up! I am going t...
Jun 25, 2019 at 10:03pm
[14 replies] Last: Ganado is correct! The way the problem was worded, I was forced to us... (by Xanadu4ever)
Structure of array
here is my code, as u see i used structure of arrays. the question is how should i take the arrays element by user directly ? #include<iostream> #include...
Jun 25, 2019 at 9:52pm
[6 replies] Last: @Zaap: int n; cin>>n; Data f ; // this is not legal C++ The f has ... (by keskiverto)
June 2019 Pages: 1234... 13
  Archived months: [may2019] [jul2019]

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