General C++ Programming - July 2014 (Page 8)

Macros in C - Basic question
 
#define A 5 #define TWICE_A (2*A) Can I use TWICE_A as above? Will the preprocessor directive manage to resolve it? I cannot compile right now, otherw...
[1 reply] : Works with the online compiler attached to this site. http://cpp.sh/4... (by wildblue)
proper way of using string array inside a class
 
class myclass{ string myarray ; myarray = "one"; myarray = "two"; myarray = "three"; myarray = "four"; myarray = "five"; }; this works in main...
[4 replies] Last: thanks programmerdog297 I got it, thankyou very much. :) (by danicpp)
linked list pass by address error
 
#include <iostream> using namespace std; struct node { int data; node*next; }; void add(node**List, int number); void display(node*List); int main() { ...
[5 replies] Last: To delete all nodes you created. Loop by your List and use delete fr... (by lsk)
Military & Standard Time
 
I've search the web, and solved all the errors that appeared till I got a clean build. Now any time I run the code I run into this issue. enter hour of mt...
[2 replies] Last: Thank you giblit. I can't believe I didn't notice this before, guess... (by closed account ybo2y60M)
Tic-Tac-Toe problem
 
I am following a tutorial for C++ where it is split into chapters, and at the end of the chapters, there is a game you must make. Here is the link: http://eboo...
[3 replies] Last: isk, it was the suppose to be announceWinner(winner(board), computer, ... (by atf1999)
Checking if variables are pairwise distinct
 
If I want to check if all the variables are pairwise distinct, i.e. they're all different. Here's a code I wrote to do this: if (s!=e&&s!=n&&s!=d&&s!=m&&s!=o...
[8 replies] Last: Duoas' method is very simple and it is the one I'll use, the other one... (by gameprogrammer)
Char Array Vs Strings
 
Ok, So I'm trying to solve a problem which is supposed to run in less than 3.5 seconds. Using same algorithm, I tried to solve it in two ways 1. Using St...
[7 replies] Last: Yes, This is a codechef question indeed, how'd you figure out? :D And ... (by newbie456)
Running a program outside ide
 
Hey after you have compiled a program can you run it without an IDE?
[17 replies] Last: By owner I didn't mean the person that is meant to posses to folder. T... (by Computergeek01)
Sending and receiving data
 
Hey all! If I have a text file named, stuff at a specified path in the c : drive, how do I send the contents of this file to another computer using the Internet...
[5 replies] Last: @ discofire : I like that description much more, it feels more concis... (by Computergeek01)
by bonho
try to understand this example code
 
I looked for a general way to get a function that does a sync/async "wait x sec and do something" and came across with below. It works perfectly but I'm trying...
[2 replies] Last: [quote=bonho]why does it call detach? [quote=kbw]detach() is called a... (by cire)
I am facing the problem with goto statement
 
#include<iostream> #include<string> using namespace std; int main() { int i,j; int begin = 0; string str = " /*com*/ //hello"; next:for (i = be...
[1 reply] : It is. You find "*/" at position 6 so when the first loop looks for " ... (by Peter87)
String is being output backwards...
 
Hi! So I have a program that will convert a string of numbers into a barcode that consists of :'s and |'s. But the only issue I have is that the numbers are all...
[6 replies] Last: #include <iostream> #include <cctype> #include <string> using namespa... (by Yanson)
by q139
string to LPVOID
 
Hello, I have problem converting string to lpvoid. It does convert but if input is "0x00309E40" output 0x13db92cc std::string adresss = "0x"; std::st...
[5 replies] Last: Thanks alot, now i am able to enter adress and pointer. Now i have pr... (by q139)
How to add the time into function
 
I have created this code with the classes for time and message. Basically the point of this code is to give the information of the sender, recipient, time, and ...
[2 replies] Last: This is how the time will be displayed!. Just a little modification of... (by Atyab)
Keylogger
 
Hey all! So im trying to make a keylogger. So far this is what i came up with: #include<iostream> #include<windows.h> #include<fstream> #include<stdio.h> ...
[14 replies] Last: Woah! Dude that's cool but I don't think I'll be able to finish it up ... (by Thedevilstail)
by Rina
Upgrading program in Visual C++ 6.0 to Visual C++ 2010
 
Hi, I have a program that is written in Visual C++ 6.0. This program is using static library. When I try to upgrade only the header file, I get error like: ...
[1 reply] : you are looking for the stdafx.h at one level up the project directory... (by writetonsharma)
Compelling use of Friends?
 
Hey guys, This is more of a general question. Have you ever encountered a scenario where friend functions were absolutely necessary or significantly decrease...
[5 replies] Last: Friends are probably a last resort. -1. Friends are part of a class'... (by Duthomhas)
A struct inside a class?
 
I'm getting confused. If I have a class declared in class.h and defined in header.h like below. I'm just not sure how it is implemented and accessed. class....
[6 replies] Last: Okay, I see. Like Cubbi said, you can use :: to access what you decl... (by lsk)
Using Global Variables in a Static Library
 
Currently I can't test it, that's why I'm asking :) Is it possible to use & change global variables in a Static Library? For example: I declare a bool t...
[3 replies] Last: When you include the file that contains the function, won't you have t... (by lsk)
by tcmn
help understanding how to interpret a function
 
I was asked to write a function : int solution(const vector<int> &A)that, given a zero-indexed array A consisting of N integers, returns any of its equilibrium...
[5 replies] Last: I too sent the wrong example. Here is the example: array A consisting... (by tcmn)
July 2014 Pages: 1... 678910... 26
  Archived months: [jun2014] [aug2014]

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