General C++ Programming - January 2015 (Page 20)

by Jt253
What will the following code display?
 
# inlcude <iostream> using namespace std; void test(int &, int =1, int =1); void test( int, int *, int&); const int SIZE = 4; int main() { int first=1. ...
[4 replies] Last: Or better yet, use a debugger. Yes, as I said in my other post to... (by TheIdeasMan)
Encryption Algorithm
 
Hi, I have got to create a program that will gather input from the user and then encrypt & decrypt those characters. I'm not very confident at coding so I'm ...
[2 replies] Last: 2. Would I need to create separate class files for both functions? Yo... (by tcs)
Call by Referenc with this as Referenc
 
Hi, I have a question. I would like to get the this pointer by call by reference. Is this possible? I hoped to get it with this code, but it doesn't work: [...
[4 replies] Last: test2 is now a copy of test1 . Both are different objects as befo... (by tcs)
logically correct or wrong ?
 
Is this program logically correct or just dumb luck ? Please see the lines 9 to 12 . That is where I made some random changes and this code worked ! #include...
[5 replies] Last: i dont think there is any need to change. its running perfect (by gaurav97)
Why is this structure member not displaying?
 
I have started working with structures so here's a side project from my text book. It's purpose is fairly simple; it asks for the sales of each quarter of the y...
[2 replies] Last: getCompanyInfo is quite wasteful: - Since the parameter R is passed by... (by dhayden)
Passing a function as a parameter
 
gcc v.8.3 -std=gnu++11 http://www.cplusplus.com/forum/general/27641/ I'm trying to pass a function as a parameter and failing. I've looked at the cpluspl...
[2 replies] Last: also, your new type (line 2) is "func", not "func_t", so lines 4 and 1... (by tipaye)
Awkward situtation ! Not able to understand..
 
This code force closes on codeblocks but works perfectly on an online compiler "http://www.tutorialspoint.com/compile_cpp_online.php". Can anybody explain why t...
[6 replies] Last: |17|error: no return statement in function returning non-void [-Werro... (by bugbyte)
C++ Factory Pattern Tutorial
 
Hey guys, I made a c++ Factory Pattern tutorial on instantiating components (much like that used in Unity) via strings. You can find it here http://blog.n...
[no replies]
Why will cout not print this std::string?
 
#include <iostream> struct WeatherStats { double total_rainfall; int high_temp; int low_temp; int avg_temp; }; WeatherStats getWeatherData(st...
[2 replies] Last: kill me now -_- (by MarkyMark)
this program works and doesnt work. explain why ?
 
hey guys ! I just wrote this code but it is giving a segmentation error. The code and its errors are just below. Please look at it and tell me whats wrong. Co...
[3 replies] Last: You got your x and y mixed up in line 9 and 10, so when you had x = 3 ... (by tipaye)
sum of the diagonals of a matrix. program giving segmentation error !
 
After entering the values of the matrix, it is giving me segmentation error. Can anybody explain why ? also "if possible", correct it #include<iostream> u...
[2 replies] Last: Thanks ;) I have made the corrections and it is working fine now. Here... (by gaurav97)
Error with binary IO
 
I am trying to make a program like a virtual machine, and therefore I need to have a virtual hard drive. I have it split across four files, each being exactly 6...
[3 replies] Last: I was wrong :) (by LB)
by ntran
Distinguishing between numbers and other symbols
 
Hi everyone, I'm reading a text file and extracting pieces of information of it by means of parsing (line by line). Here is an example of the text file: 0 ...
[1 reply] : Try to read, if it fails then it was not a number. #include <iostream... (by ne555)
by LB
What exactly is std::iostream::pos_type?
 
http://ideone.com/V5kx2p[code firstline=6]std::cout << sizeof(long long) << std::endl; std::cout << sizeof(long double) << std::endl; std::cout << sizeof(std:...
[1 reply] : It's std::fpos<std::mbstate_t> , and it's not just offset, it's also ... (by Cubbi)
by dkaip
How code must be to not have multiple definitions of var?
 
Hello, In code i don't understud how code must be to not have multiple definition of var? If i have a function how i must put? memory.h #ifndef MEMORY_IN...
[1 reply] : http://www.cplusplus.com/forum/general/140198/ (global variables) don'... (by ne555)
Help with input file sorting?
 
Hi everyone, im kinda new to c++ but i know the basics as i had to take an intro course as one of my classes last term. right now im on my work term and i have ...
[1 reply] : so yeah just clarified what im supposed to know what to do with the c... (by NuckFuggets)
Please Help Me Define and Macro Not Check Value
 
#include <Windows.h> #include <iostream> using namespace std; #define MAX(a,b) (((a)>(b))?(a):(b)) int main() { int a = 7; int b = 5; cout ...
[2 replies] Last: ok thx but how can make macro same _MSC_VER return integer and can che... (by HelpAsking)
by Matep
saving RGB pixel data of a .jpeg image in 3D array
 
I need to save RGB values of each pixel in a 3D array A . I found a code online that transfers the bytes into an array but I cant understand how bytes are sav...
[6 replies] Last: Sure, but then i also have to change the quality enchanceing algorithm... (by Matep)
by tmason
C vs C++ - Request for more information ... (1,2)
 
Hello, I know this is a debate that has been raging and debated forever, but I am wondering if there is any definitive information on this: is C faster than ...
[24 replies] Last: Excellent! I knew white papers existed but I guess I was searching inc... (by tmason)
Data Segment Backups
 
Hi dears I want to have a backup of the data segments of my running program. How do that in c++? I need restore it a few seconds later. Thanks
[2 replies] Last: Unusual but quick solution: In Posix You can fork(). Second process ma... (by Konstantin2)
January 2015 Pages: 1... 1819202122... 24
  Archived months: [dec2014] [feb2015]

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