Beginners - November 2018 (Page 18)

by az1234
swapping characters in string array
 
Hi, I have an array of strings and there about 20 lines that array. I'm wondering if there is a way I can check the first character of each line and see if one ...
[8 replies] Last: Hello az1234, PLEASE ALWAYS USE CODE TAGS (the <> formatting button... (by Handy Andy)
by AL88
How can I make the if else shortcut compile?
 
How do I need to re-write the if else shortcut on line 51 to make it compile? #include <iostream> #include <string> template <class T> class List { ...
[6 replies] Last: Are you sure your problem is solved? It might compile but it's far fr... (by coder777)
counting number of occurrences of digit d
 
Hi i want to write program that counts number of occurrences of digit d in a given range. here is my code it works but the problem is time.it check all n...
[3 replies] Last: #include <iostream> #include <algorithm> using namespace std; //===... (by lastchance)
by warku
passing variable between two objects
 
Hello dear forum, I used the tutorials here to learn a whole lot, thank you. Now I have a problem: There are two classes, one in /origin/directory1/src/class1....
[13 replies] Last: For example: [quote=helios]Every time you add global state you make it... (by keskiverto)
by mck99
Accessing elements of const pass by reference std::list
 
What would be the proper way to access elements that are passed by const reference? Specifically std::list. ex. const std::list<std::string>& someStrings I u...
[2 replies] Last: When an object is pass as const reference it means that you can use fu... (by coder777)
by Tduck
How to declare a class template?
 
How to declare a class template? I tried, as seen below, but can't seem to get it to work. The error I get is explicit qualification in declaration of at line...
[1 reply] : If you want to define a function of a template class outside that clas... (by coder777)
using sstream
 
I am new to sstream. I am also trying to convert a double to a string. I need a set precision of 3 so that is why I need to use it. I've tried a bunch of differ...
[1 reply] : Hello noshkren, It would be a good idea to edit your OP and remove th... (by Handy Andy)
solve this and post it in comment
 
The program is supposed to take in two numbers from the user and display them separated by a comma, with the smallest one displayed first. This program does run...
[4 replies] Last: anthony2011 , I'm willing to give you the benefit of doubt. I've ed... (by closed account 1vRz3TCk)
Can't multiply two 5x5 matrices
 
I'm very new to c++ and I'm confused as to why my code isn't working. I feel it's an issue with the final array (array3). I don't know what though. If anyone ca...
[3 replies] Last: You have a == instead of = for your assignment to array3. And you prob... (by tpb)
I need help here
 
I just asked those questions, but I need the feedback, and I did not find it available, someone knows the feedback of this material so that I can correct it. th...
[6 replies] Last: Or is + if you dont % though. 0+0 = 0 0+1 = 1 1+0 = 1 1+1 = 2/ still '... (by jonnin)
by AL88
How do I get the List constructor to work for line 47?
 
How do I get the List constructor to work for line 47? I tried writing it out as the compiler suggested it but it then asked me to make a template specializati...
[19 replies] Last: There are multiple error (at least three) so the best way to approach ... (by Peter87)
Can't pass std::function as a parameter because there is no suitable conversion.
 
Hello, I have a function that takes function pointer as a parameter. Sometimes I would like to pass lamba instead of function pointer. However, my lambda captu...
[13 replies] Last: So the idea is to wrap capturing lambda in capturless one :) You can... (by Peter87)
Beginner of beginners; lost on how to complete this assignment
 
im trying to code hangman; im familiar with c++ and i understand the content in class but when it comes to completing the assignments im completely lost. thi...
[6 replies] Last: your professor is forcing you to do something the wrong way, which ref... (by jonnin)
loop help
 
Write your question here. So i have to write a program and one requiremnt is that I have to implement this If the file has not been opened correctly, print ...
[2 replies] Last: Hello ineedhelp2, PLEASE ALWAYS USE CODE TAGS (the <> formatting butt... (by Handy Andy)
can't understand the question on my assignment
 
The task given is: You are to write a C++ program that reads in a WAVE file, reverses the audio samples, and writes the result to a new WAVE file. Specifically...
[2 replies] Last: Well, since WAV PCM is uncompressed, it actually isn't too hard to jus... (by Ganado)
Code for finding the freqency of Chars in a text file
 
Hi I'm working on a bit of code that's supposed to populate an array with the frequency of each letter in a text file. It's segfaulting in the while loop for so...
[2 replies] Last: Line 19 is of course dangerous. If a character doesn't fit in that pat... (by coder777)
Finding a way to count the number of comparison in C++ STL sort
 
Hi everyone, I'm trying to find a way to count the number of comparison done by the C++ STl sort. I've been thinking about this for a while and my only solutio...
[3 replies] Last: Thanks for helping me (by Song Tung)
Using CreateFile Function
 
hi, I'm currently doing an activity where I'm going to open a file and read the content of it by using CreateFile Function. This is the code that I made just ...
[1 reply] : I suggest you use the C++ standard library functions. The windows syst... (by tpb)
how to call 2d arrays with arguments
 
I have not posted the entire code, just the part where I get the error. I keep getting this error when i run the code: error: cannot convert ‘int*’ to ‘i...
[8 replies] Last: Thanks. I hope i made the correct adjustments. (by tubeethet)
by ICantC
std::getline valid input check doesn't work if false is ever returned
 
hello, I have the below code which asks the user for input into a string, then checks whether that string is present in a vector of strings (member of class) t...
[7 replies] Last: Just std::count would work: bool guess_valid(std::string guess) { ... (by mbozzi)
November 2018 Pages: 1... 1617181920... 24
  Archived months: [oct2018] [dec2018]

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