General C++ Programming - December 2013 (Page 17)

If-statements: Scope
if(true) cout<< "what's the difference"; if(!false) { cout<< "between this and the previous if statement?"<< endl; } One has a block scope, the oth...
Dec 14, 2013 at 1:23am
[3 replies] Last: eh... I suppose... @sirolou: That's implied. The statements with ... (by IWishIKnew)
A LITTLE PROBLEM....REQUIRE VIEW
i wrote this code but don't know if the numbers i array for p will generate in that order. Can you help in how to get 5 random numbers horizontally and insure t...
Dec 13, 2013 at 10:39pm
[3 replies] Last: Here are some things I noticed: 1.) Opening brace on line 4 is not ne... (by xismn)
?? what types of files will be needed?
Write a program that plays the game MasterMind. The program should create a list of 4 color; the available colors are (R)ed, (G)reen, (P)urple, (Y)ellow, (B)lac...
Dec 13, 2013 at 10:38pm
[4 replies] Last: Depends on what you want to do. You might want to use 500, you might ... (by IWishIKnew)
by fag
want to add an error message if cin is not a number
#include <iostream> #include <stdlib.h> //used for random numbers #include <time.h> #include <string> using namespace std; int main() { int bridg...
Dec 13, 2013 at 8:35pm
[3 replies] Last: Or for an example of a more generic approach: http://www.cplusplus.com... (by cire)
C++ tutoring
Hello, I'm a freshman I'm college and finals are next week. I kind of understand c++ but when it comes to homework, I freak out and always get the program to gi...
Dec 13, 2013 at 7:43pm
[6 replies] Last: Rodiongork, that's just wrong. You can teach programming. The real i... (by IWishIKnew)
Dynamically allocated array of function pointers
Hello, I would like to know if this code is correct. #include <iostream> #include <string> int say_one(const std::string &s) { std::clog << s << "...
Dec 13, 2013 at 7:28pm
[7 replies] Last: What's awkward is function pointer syntax in conjunction with new ... (by LB)
by zajcev
TIFF file reader
Hello, first of all sorry for my English :) I have program which reads tiff files, and shows header. #include <iostream> #include <fstream> using n...
Dec 13, 2013 at 4:55pm
[1 reply] : I commented out everything but this line below and the program crashed... (by SamuelAdams)
Pointer undefined behaviors?
To my knowledge, the following are UB's (I'll give code below to be corrected if necessary): 1) dereferencing dangling/invalid pointer 2) going out of boun...
Dec 13, 2013 at 3:06pm
[6 replies] Last: Thanks for the replies, it did not occur to me that it may be "impleme... (by Catfish666)
RSA encryptor
Hello I wrote a c++ program to encrypt some text but the resulted enctypted array is only blanks I investegated that , and I found the error source , b...
Dec 13, 2013 at 11:01am
[1 reply] : The problem is that when you generate the two prime numbers, in both c... (by Mitsuhashi)
Set value of unique_ptr
Okay so say I have this. std::unique_ptr<int> Blocks ; Blocks = std::unique_ptr<int> (new int) then I would like to do something equivalent to this *...
Dec 13, 2013 at 10:51am
[5 replies] Last: SEGFAULT ? The program crashes ??? I don't know I never try ... I gue... (by rmxhaha)
Planets program---URGENT!
Hey guys, need some help in figuring how to write this program. The program should have a menu with the following: 1)Add planet (prompt for name, radius, m...
Dec 13, 2013 at 9:11am
[9 replies] Last: looking okay. now you need to read up on some vector methods like: 1. ... (by mutexe)
by Chubby
I dont understand this!
int Sum (int, int, &int) i dont understand the &. but i do understand if (a=9 && b=3)
Dec 13, 2013 at 7:58am
[2 replies] Last: A single ampersand is the reference operator. There is no such thin... (by cire)
how to delete unique_ptr
I was wondering how I would go about deleting just a single member in a unique_ptr array here is what I have: std::unique_ptr<Foo> Blocks ; Blocks ...
Dec 13, 2013 at 7:44am
[1 reply] : delete Blocks .release(); http://en.cppreference.com/w/cpp/memory... (by cire)
Displaying last TWO largest in a binary search tree???
How would I display the last two largest nodes in a binary search tree recursively???? I don't know how to approach this, and would like some help. Thanks!
Dec 13, 2013 at 7:33am
[1 reply] : pseudocode: a = root b = 0 while a != 0 and a=>right != 0: b = ... (by Smac89)
storing in an array
Hello, I am new to C++ and I wanted to get the output from the following code. My objective is to get all permutations of DNA words for a given number of lette...
Dec 13, 2013 at 4:54am
[1 reply] : gd (by Craigneal)
Set an entire array to NULL
Okay so I've declared an array like this. Foo *Blocks = {0}; and as far as my understanding goes This creates an array with every member set to N...
Dec 13, 2013 at 4:49am
[8 replies] Last: Thank you, The smart pointers sound great! (by Og The Trog)
by LunarB
WriteProcessMemory with a Base and Offset - C++
Sorry that this is my second post on this topic (It's been a LONG while since that post.) But I still haven't figured out how to write to memory WITHOUT gett...
Dec 13, 2013 at 3:58am
[no replies]
Palindrome program not giving proper output
I did write this program for homework, but I am stuck, and am just looking for some advice or direction. When I enter a string of integers, say 1 2 3 2 1, my ou...
Dec 13, 2013 at 2:48am
[2 replies] Last: Wow! I got rid of the cin line, and read your second post from the lin... (by TychoKaine)
Returning two seperate variables in a function?
Today class was really rushed, last class of the semester until the final. He gave us a very, very basic function program and 5 homework assignments. I have all...
Dec 13, 2013 at 2:27am
[9 replies] Last: He requires a set format and will dock points of you use anything but... (by xismn)
Maps
I'm very very new to maps and am really just trying to hash them out by myself. If you're mapping strings to integers: map <string, int> myMap; myMap[...
Dec 12, 2013 at 11:01pm
[4 replies] Last: Reap up: http://www.cplusplus.com/reference/map/map/?kw=map (by IWishIKnew)
December 2013 Pages: 1... 1516171819... 37
  Archived months: [nov2013] [jan2014]

This is an archived page. To post a new message, go to the current page.
Registered users can post in this forum.