Beginners - June 2017

Initializing two-dimensional vector of type Class
 
Hello, I have one question. When I was using int as type of my vector I initialized it the way you can see below. But now, I want to create vector of type Valu...
[1 reply] : # include <iostream> # include <vector> # include <iomanip> class V... (by gunnerfunner)
by Meden
Where is my mistake? Project Euler Problem 9 - algebra, <complex>, or something else?
 
From: https://projecteuler.net/problem=9 "A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a^2 + b^2 = c^2. There exists exactly...
[5 replies] Last: I should make a, b, c ints, or you may hit floating-point round-off er... (by lastchance)
by ebii
interhance
 
hey guys iam a bit stuck with some program that i try to solve #pragma once #include<iostream> using namespace std; #include<iostream> #pragma once templat...
[3 replies] Last: You probably want runtime polymorphism : #include<iostream> #include... (by keskiverto)
weird for loop
 
Could someone explain to me how this for loop work ? i just don't understand the 2 extra conditions: beg = authors.lower_bound(search_item), end = authors.u...
[1 reply] : Those are not conditions; they are just assignments. The condition is ... (by Zhuge)
continue statement
 
Quick question: assume that I have the following structure, will the "continue" command successfully lead me to the next iteration in the outermost for loop? ...
[7 replies] Last: @mbozzi: thank you for referring me to this article! As I am not a nat... (by lifeisgood)
Problem Linking Headers and Source File
 
Hello, im new to c++ and am trying to link a header and source file to my main source file. Its simple and ive looked at videos everywhere and read alot forum ...
[14 replies] Last: > undefined reference to `WinMain' chose `Console Project' (by ne555)
how to iterate through char array
 
i have associated a pointer to a char array. I would like to print each element of the char array using the dereference pointer notation. for some reason it wou...
[11 replies] Last: asd (by masterinex)
Where is the lib definition defined in a project?
 
Although I am not new to C++, linking has always been a bit confusing for me... so I suppose this may be a beginner question... ?? If I am using a dll and link...
[1 reply] : Where is the STGPLUGINCLASSES_LIB symbol typically defined? Usually ... (by coder777)
Can I code this better?
 
Few questions here, I thought I could use Nested else if statements here but I'm trying to go exactly what the program tells me to do. I may of over-complicated...
[1 reply] : struct substance{ double fusion_temp, ebullition_temp; std::string ... (by ne555)
how to declare a reference to a pointer
 
i would like to create a function which takes in a reference to a pointer.for some reason when i build this, I keep getting cout and endl undeclared identifier....
[1 reply] : The error you encountered is due to using namespace std; coming afte... (by lazpeng)
by Caruso
2d array
 
Hi All, This is from a problem published on heakerearth.com We need to create a 2 dimensional array and fill it. for the creating of the array I've used: ...
[1 reply] : this is all weird. if you want 10 columns, n = 10. you get to it fro... (by jonnin)
what are the benefits of using Copy initialization form ?
 
i know that when we use the copy form (=) the compiler will pass the right-hand operand to the copy-constructor of that class. in addition, the compiler ca...
[5 replies] Last: thanks keskiverto , gunnerfunner for replying. i just wanted to know i... (by AhmedEl3agamy)
Reading hexadecimal from file and converting to integers
 
So my assignment is to read an unknown amount of hexadecimal numbers from a file into a char array, create a function to convert it to regular numbers, and then...
[9 replies] Last: The conversion and subsequent addition to a sum is where I'm having m... (by dhayden)
how to check if a command line argument ends with .txt
 
I am trying to write a program which checks if one of the command line argument entered ends with .txt . If one of the arguments ends with .txt, then an input ...
[7 replies] Last: The code will check for ".txt" in any command line argument, so long a... (by dhayden)
i/o vector of strings to text file
 
hello i'm trying to write and read a vector of strings to/from a text file. it should count how many lines contain the word "here". but it does nothing. ...
[5 replies] Last: oh, now i see why the text file wasn't human readable. thanks everybod... (by Stauricus)
How could I test whether the input parameter is uninitialized (1,2)
 
I have 4 arguments are integers, and for consistent reason, I want to test the input argument is initialized with a number. How could I do this? UPDATE: Thank...
[20 replies] Last: @JLBorges What is your problem? If the functionality of optional mee... (by coder777)
How do I merge text files in different sub-folders with path in it?
 
as tile~ so far, I did output a dir.txt that listed all the targets with this CMD code: D:\>dir /s /b Parent\*.txt >D:\dir.txt inside dir.txt: D:\...
[1 reply] : std::filesystem::recursive_directory_iterator (C++17) http://en.cppref... (by JLBorges)
syntax question
 
hey, so there's 2 ways to declare a variable of class first : mystring ex("lol"); second : mystring ex{"lol"}; which one is better ?
[3 replies] Last: One thing to keep in mind is that they are not always equivalent: The ... (by mbozzi)
Moving in two dimensional vector
 
Hello, I'm having one problem. Imagine you are having two dimensional vector in which you want move generated number and you will get this: 0 0 0 0 0 2...
[9 replies] Last: Just in case someone would struggle with the similar problem in the fu... (by david73)
by ebii
handling with files
 
hey guys how i read from files only int/or some char data let say i have list of student name + grade in file like name1 80 name2 90 and i want to take fro...
[5 replies] Last: thanks alot thomas . (by ebii)
June 2017 Pages: 123... 16
  Archived months: [may2017] [jul2017]

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