Beginners - July 2016 (Page 24)

Resume a solution
 
Hi, I have a time dependent problem which needs to be solved. I need to solve my model for different time say 1s, 10s or bigger. considering that I solve the mo...
[3 replies] Last: Maybe save the state of the machine/program at the particular intermed... (by closed account 48T7M4Gy)
How to adapt to read a file in different formats?
 
Hello, I am in a mess I wouldn't know what to do if I were to retrieve data from a file in different formats. For example : (1) Wales 0.12 60 Ronaldo 0....
[1 reply] : If the first field (name) does not contain embedded commas or white sp... (by JLBorges)
2arrays & Structures
 
Expect the following to print values of the 2D array #include <iostream> using namespace std; struct matrix { int matrice ; int row; int co...
[9 replies] Last: The above approaches seems complicated for me, but thanks anyways (by Ehit Karim)
Project Euler, problem 21
 
I'm trying to solve problem 21 from Project Euler site, I think that I don't have any mistakes, but I get wrong result, can anyone find mistake that occurs. I g...
[16 replies] Last: Woah, I noticed this : Amicable found (284 - 220) Amicable found (22... (by Naughty Albatross)
Function determining distance object falls with time given as argument
 
Good evening guys. I'm working through this problem and feel like I've exhausted my resources. This function is attempting to take the time in seconds as an...
[5 replies] Last: Cheers, no pills required - just experiment and practice :) PS There'... (by closed account 48T7M4Gy)
by WhatIf
c++ binary files
 
Hi, I have been searching online for examples on how to write binary files in c++ but the only example I was able to find was about reading a binary file. htt...
[7 replies] Last: > Does that mean that the null-character ('\0') is written to disk? Ve... (by Naughty Albatross)
Random Number Generation
 
Okay, so lets assume im using a simple number generator such as : int ranNum; srand (time(0)); ranNum = rand()% 10 + 1; cout << ranNum; If i were to ad...
[8 replies] Last: Anyway, it is not needed. Not now... It never was. I couldn't have... (by Yawzheek)
Finding Actual STL/Legacy Code
 
I suspect the title may not be perfectly clear, but I mean to ask if it's possible to find the actual code that implements some of the functions built into the ...
[8 replies] Last: I'm not even going to lie to you, for some stupid reason I thought str... (by Yawzheek)
CSV importing and storing in vectors as ints and floats
 
I have a csv file in the format of: col1, col2, col3 54647, 656, 656 65654, 536, 656 65656, 656, 656 I want to store them in std::vectors using #include <s...
[6 replies] Last: Thank you! (by BMW330i)
Operator Overloading
 
Hi guys, I have a problem. Maybe someone can help me. In the first example I tried to overloading operator +, all good, works fine. In the second example, doesn...
[4 replies] Last: Yes, you are right. Thanks a lot for your help. You are a good man :D (by Dezibil Ad)
Function with parameters (1,2)
 
Values arent passing correctly #include <iostream> #include <iomanip> using namespace std; void display() { cout << "*** BASEBA...
[20 replies] Last: If you don't need switch yes you can use if : while (item != 8) { ... (by Naughty Albatross)
by Kaisky
pointer to object, but object gets lost...
 
Hi! So in the following code i have a class, 'Box', that saves a integer 'value'. Then i run a function in which i set the global pointer 'my_box' on a new box(...
[5 replies] Last: So i always have to create an empty constructor Box::Box() {} as well... (by AbstractionAnon)
Help for beginner
 
Why is this making the program crash? #include <iostream> using namespace std; int main() {int n,i; cin>>n; for(i=0;i<n;i++){ if(n%i==0)cout<<i<<" ";} ...
[3 replies] Last: ah yeah, I am dumb. Thanks :) (by Kostadin)
Number range switch statement
 
Hey guys, I just started c++ after doing a few years in python and java. I thought I'd give c++ a challenge as it is supposed to be difficult. I just want to kn...
[12 replies] Last: Keep up the good work :) (by closed account 48T7M4Gy)
coloring a single word in a text
 
how do i color a single word in a text? lets say if i have the text: "hello i'm Bob" i want to color only "i'm" in red. i know that: HANDLE handle = GetSt...
[6 replies] Last: thanks everyone for help i have done what i needed without coloring by... (by globaltourist)
Beginner questions about overloading + operator
 
This is from Ivor Horton's Beginning Visual C++ 2013: It gives an example of overloading + operator for a simple class called box. The box basically only 3 dat...
[2 replies] Last: 1) No. Copy elision (Return Value Optimization), creates a single in... (by AbstractionAnon)
by Carat1
help with getmodulehandle
 
I need help adding an address to GetModuleHandle. I'm using GetModuleHandle to get the module address of the exe because the module address changes every time I...
[2 replies] Last: i found a video that can help me http://m.youtube.com/watch?v=imgEgeoY... (by Carat1)
round() problem
 
Hi there I want to solve this problem mealprice=12.00 tip=20 tax=8 they're given as input I should calculate the totalcost this way: tip=12*20/100=2.4 t...
[3 replies] Last: You are very welcome. :) (by Thomas1965)
by Lodi
c++ 2D dynamic array defaulting to size 4
 
Hi. Below is my c++ code. I am trying to create a 2D dynamic array which is created with the correct number of rows and columns. However, I can't seem to access...
[4 replies] Last: Thank you Peter87 and kemort, works perfectly now. The example also ma... (by Lodi)
by hrxs1
while(cin) does'nt react to keyboard input
 
Hello everyone, I am currently working with Stroustrup's Book "Programming Principles & Practice Using CPP". At the moment, I am at Chapter 6, "Writing a progra...
[9 replies] Last: Glad to hear :) (by Naughty Albatross)
July 2016 Pages: 1... 2223242526... 30
  Archived months: [jun2016] [aug2016]

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