General C++ Programming - August 2015 (Page 4)

how to find the no of digits after decimal point exactly
 
//c++ code int nocheck1(float e) { float q; int count1=0; q=e; while(q!=(int(q))) { count1++; q=q*10; } //cout<<count1; return count1; } this code will prov...
[6 replies] Last: I'll just leave this here: https://gist.github.com/Helios-vmg/abd9ef11... (by helios)
if statements on parts of a string
 
Hi, can someone help, I want to write "if statements" on parts of a string and I am not having any success. Here is some sample code to show you what i mean. T...
[3 replies] Last: Perfect, thanks FurryGuy. Sorry about the lack of code tags (by GerardG)
Templates and lambdas, "incomplete type is not allowed" and
 
Right, it's been a while since I've done anything in C++ so if it's something really stupid gimme a break :) Also I've never really used lambdas either so same ...
[5 replies] Last: Okay I'll apologise for that as I moved the templates above and it's f... (by TheBeardedQuack)
Error
 
Getting this error here: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'char *' [-Wint-conversion] ...
[7 replies] Last: Your original code was recursive; this too is recursive (it uses your ... (by JLBorges)
Taylor Series Lab
 
Having some trouble starting this in c++ language Consider the problem of approximating ln(1.9) with ten digits of accuracy, using either of the follow...
[1 reply] : 1. In series (A) use -0.9 . In series (B) use 0.9/2.9 . (by skaa)
by AcarX
How to read from a file with hex address
 
I need to read an entry from a packed file by it's hex address but i'm not sure how to approach this. Here's how an entry from reference file looks like: fi...
[4 replies] Last: Thanks for help. (by AcarX)
by nbt
Initialization via constructor
 
Hi! I am learning about classes right now and I am getting used to initializing data members like this: class Cat{ public: Cat(int age){itsAge = ...
[2 replies] Last: Perfect, got it. Many thanks. (by nbt)
by leourb
Sorting half of vector - Syntax
 
Hi everyone. I have read on my book that to sort an half of a vector I can write sort(v.begin(),v.begin()+v.size()) It is a bit unclear. v.begin() poi...
[2 replies] Last: I missed the parenthesis, sorry! Anyway in page 676 of C++ Programmi... (by leourb)
q: abt static-cast function
 
Below code - simply experimenting with it to learn more abt static cast functions. THe purpose of the code was to show type conversion. What I don't understand ...
[6 replies] Last: > error redeclaration Don't redeclare; reuse the same variable. int... (by JLBorges)
by LASims
Type cast issue
 
unsigned long mSecDay = 0; double secondsOfYear = 0.0; mSecDay = 52575812; secondsOfYear = (double)(mSecDay) / 1000.0; in the debugger it shows answer a...
[5 replies] Last: Another alternative is to use rationals instead of floats. The only pr... (by helios)
Reading from file input problem !!
 
i face a problem when i read input from a file, so what is the solution of this problem ? the input format is ---> 4 4 1 2 3 4 5 6 7 8 #include <iostream> #...
[5 replies] Last: thank you LB (by mahmoud2592)
closed (1,2)
 
closed
[30 replies] Last: thanks , may i check how do i print out the array after this as size i... (by techishawn)
Virtual Pointer for Virtual table
 
Is virtual pointer inherits to derived class? I tried this and got the ans that 'yes'. Pleas check following example: class ClassABC { public: ClassABC...
[13 replies] Last: Right......... (by akash16)
by yj1214
How does native window api display graphics?
 
How does qui libraries like win32, cocoa and other libraries draw their graphics? (like buttons, background etc.) Do they use OpenGL?
[1 reply] : Search keywords: Graphics Device Interface (GDI), Quartz, DirectX. (by keskiverto)
by LB
MSVC chokes on template metaprograms
 
I'm getting an error in Visual Studio but not GCC or Clang. I have already tried my best to reduce the complexity of the code, but it is quite complicated becau...
[2 replies] Last: It's supposed to connect real C++ member functions to an ancient C lib... (by LB)
by mnm71
How convert vector 2D to char array??
 
I want to convert vector<vector<unsigned char> > v to char a and then convert char a to string ?? how can do this in c or c++??tank you...
[19 replies] Last: @JLBorges yeeeeeeeeeeeeeeeees tank you very very much it is work.... (by mnm71)
whitespaces are killing me...
 
I've been working on this all night and for some reason I can't seem to get the output to come out right. here is my code: #include "stdafx.h" #include <iost...
[7 replies] Last: I can't believe I missed that all this time... missing one = :( <pick... (by newby13)
Copy elements of pointer.
 
I tried to understand pointers and I cant figure out how to copy the elements of the array that the pointer point to. int main(){ char a = {'a', 'b...
[5 replies] Last: Hi, Array should be of size 4 at line number 4. For your que : "is th... (by akash16)
Segmentation fault
 
Hi, I try to run this code and i got segmentation fault. #include <iostream> #include <string.h> #include <string.h> using namespace std; string sf(...
[2 replies] Last: so as you point out about the return. i modified my codes and it works... (by hahacprog)
by leourb
Operations between two classes
 
I have wrote two template classes: Vectors.h #include "std_lib_facilities.h" #include "Numbers.h" #ifndef Vector_Advanced_Vectors_h #define Vector_Advanced_V...
[6 replies] Last: Yep it was.. I have done! Thank you for your advices LB :) (by leourb)
August 2015 Pages: 123456... 17
  Archived months: [jul2015] [sep2015]

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