General C++ Programming - October 2014 (Page 29)

Copy Constructor
 
#include <iostream> using namespace std; class A { public: A() { cout << "default A" << endl; } A(const A&) // copy constructor { ...
[3 replies] Last: Yes, it is. (by kbw)
Storing Information in String?
 
Is it possible to store information in a string without user input? If so, what code would I use for it?
[2 replies] Last: It is for a shcool assignment, and I figured it out. (by TheUnholy)
Stuck
 
How do you add new items to a vector in a header/implementation project? I'm working with headers and implementations. I'm doing a "grocery cart" assignment. H...
[5 replies] Last: instantiate a Customer object and call receipt() on it. Customer c... (by mutexe)
Just curious if this would be correct?
 
string s1 = "Hi", s2 = "Hello", s3; s3 = (s1 < s2) ? s1 : s2; cout << s3; 1.)Write out what output this code generates. 2.)N...
[2 replies] Last: Makes sense! Just a quick question you used branching correct? Thanks! (by michaelmhmhmh)
Algorithim for deleting lines in tetris?
 
I'm making tetris but didn't go the conventional way of using matrices to hold binary id's of my shapes. I thought it would be easier that way, but now I'm stuc...
[1 reply] : 1) I suggest to not store playing field as shapes. After particular sh... (by MiiNiPaa)
Refference to temp Object
 
#include <iostream> void print_me_bad( std::string& s ) { std::cout << s << std::endl; } int main() { print_me_bad( std::string( "W...
[1 reply] : Am I correct ? No. Try this: #include <iostream> void print_me_bad(... (by coder777)
by Ndrewm
Creating a LOGIN (username and password)
 
Im tryin to create a login that accepts a user login and password. it should accept 3 tries in which when the user enters their username the system should tell ...
[18 replies] Last: thnkz i have not gotten to really edit it much yet because i've been l... (by Ndrewm)
Efficiency Quesstion
 
Hello, Let's say we have a custom Vector class and I need to know which of the following is considered to be more efficient and why of course. Vector V...
[1 reply] : The 2 versions are equivalent. (by kbw)
A faster algorithm than dijkstra's algorithm
 
I'm trying to solve a variation on the shortest route finding problem. The mazes have n intersections with m corridors. Each corridor has two intersections. ...
[no replies]
number of records in binary file is in decimal
 
Hi. My size of binary file is 1920 KB and my struct size is 124 kb. now to find number of records in file I divided 1920/124 and it gives me 15.4.... do I add ...
[9 replies] Last: fixed it..thanks...damn null character (by csstudent123)
by kor564
Can anybody help me?
 
----- main.cpp source #include <iostream> #include <stdlib.h> #ifdef __APPLE__ #include <OpenGL/OpenGL.h> #include <GLUT/glut.h> #else #include <...
[3 replies] Last: <<<<< text3d.h source >>>>>>>>>>> #ifndef TEXT_3D_H_IN... (by kor564)
C++ Nested Loop
 
hi there, i specify other Looping codes but i am hardly to make an output like this. Output should be like this (Ctrl+F9) 1 12 123 1234 12345 I...
[8 replies] Last: this works good techno # include <stdio.h> //# include <conio.h> //... (by closed account 1CfG1hU5)
Opens new command prompt window for input
 
Hello, If I compile code which uses cin using the command prompt, then run the compiled program a new window opens when it reaches the cin line of code, for ...
[1 reply] : I'm pretty sure that before networking was started, people used socket... (by poteto)
by Emkor
What Am I doing wrong
 
Forget the standard diaviation for now. Why isnt this working? #include <iostream> #include <iomanip> #include <cmath> using namespace std; //Symb...
[19 replies] Last: believe was close to fixing your code. idea for num 1 through 4. cou... (by closed account 1CfG1hU5)
by sebz92
store text to nodes
 
so in this program i have two structs struct node{ string data; node* next; node* prev; }; struct list{ node* head; node* tail; }; one...
[2 replies] Last: this is what i have now: no = new node; // new node ... (by sebz92)
need assistance
 
ok i am working on an elevator system and i am stuck... in the arrival method i am trying to get 400 workers to arrive within 3600 seconds... doing this voi...
[4 replies] Last: no it is definitely not thank you for clearing that up imma have to lo... (by montana 1990)
Trying to implement a Sparse Matrix w/ input from file
 
Hi all, for my CS project I have to implement a Sparse Matrix from an input from a file or from input from the console. I keep getting a few errors and don't kn...
[no replies]
IRC Client
 
I would like to write my own IRC client, but I do not know what kind of code would be needed. I know this will probably take a while to make, but I have a lot o...
[1 reply] : could download mirc from www.mirc.com for reference. items: socket c... (by closed account 1CfG1hU5)
Binary search or Linear Search for 3d Array
 
I need help with inputting a search array. I tried putting a binary search but I can't get it to work. everything else works up until I put the value I am searc...
[3 replies] Last: Your program asks for two inputs only and calculates the distance betw... (by Duthomhas)
(for)(do)(while) loops using Xcode
 
Write a C++ program that will input from the user a positive number n and find its factorial. Don’t forget to validate the input. The factorial of a positive ...
[1 reply] : Why don't you post your code, and we can help point out where you are ... (by doug4)
October 2014 Pages: 1... 2728293031... 38
  Archived months: [sep2014] [nov2014]

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