Hi all. Im trying to make a function to try to attempt something, but when it fails try "one" more time and then move on to the next thing.So far i've made something that doesnt look close to what i have to do.#include <iostream>#include <string>#include <windows.h>using names...
i have linux XUbuntu , gcc 4.1.2 , kernel 2.6.20-16-generic.i have processor celeron 533 , pentuim2 family , ram of 196this piece of code is acting strange 2 files : 1- main.cpp 2- subsetsubSet#ifndef __SUBSET__#define __SUBSET__#include <vector>#include <fstream>using namespace s...
Hi guys!I need a bit of help understanding the malloc() function better. I understand it's basic purpose, however, I don't understand why the following line of code works:char * line = NULL;line = (char*)malloc(sizeof(char));I am grabbing line by line from a file analyzing it and produci...
4095 byte By
muran at 2007-11-20 10:54:27
hey guys, i am designing a program where you have an input file.. on this file it says...onetwothreedeadendbasically you have to look through the file with all the words and check weather the first letter of the first word is equal to the first letter of the 2nd word, then check if the first word is...
620 byte By
Dannaeus at 2007-11-20 10:54:59
I'm relatively new to C, so I apologize if this is a stupid question.For learning purposes, I'm trying to create conditional logic using only bitwise operators (! ~ & ^ | + << >>). My function takes 3 ints (x,y,z).I would like the logic of my function to execute as follows:If...
311 byte By
shreer at 2007-11-20 10:55:00
Hi all, When compiling my c++ code in xcode , I get an error as "ERROR: setup_display was not declared in this scope"What does it mean?P.S: "setup_display" is one of the functions declared in the header file.Can someone pls help me fix this bug...its urgent......
684 byte By
Chrispy at 2007-11-20 10:55:05
I'm writing a program that inputs web logs from a file. I need though to split each part of the log into it's separate parts. What I can't remember is how to set which character to stop inputting for. The default as you know is white space (I.E. each time a white space is reached in t...
2187 byte By
Y_Y at 2007-11-20 10:55:06
I created a C++ Winsock server that host on port 80.Everything seems to be working very good but there is only one problem:The server that i created works like this:I use ifstream() to get the frontgage.html file and put it into a char *buffer variable.I host on port[80] and listen(), waiting for an...
I am new to learning C++ and this site. How can i keep count of how many time i go through a loop. i want to latter use that in the code to calculate the average.<br/>Basically im looking to see how many time the loop circles each time??<br/>any help would be great. thanks
what would be the easiest way to align something like the following:<br/>TOTALS<br/>Total Payroll: 750.00<br/>Number of Checks: 2<br/>Average Paycheck: 375.00<br/>Total SS withheld: 60.00<br/>Total Withholding: 75.00<br/>setw?
377 byte By
rba1988 at 2007-11-20 10:55:23
Hi. How do I code a loading interface on the console? I have a function that takes some time to process and I want to print something out on the console to show that it's still processing. For example, while the function is doing it's thing the console will show simultaneous "." or # for e...
596 byte By
rba1988 at 2007-11-20 10:55:25
int main( int argc, char *argv[] ){ if( argc != 2 ) { printUsage(); exit( 1 ); } char *options[argc]; for( int i = 0; i < argc; i++ ) { options[i] = ( char * )( argv[i] ); } if( options[1] == "printout" ) { cout << "hello" << endl; } return 0;}I can't seem to get the word "...
Sup guys,I decided to multi-task and learn Win32 and OpenGL at the same time. Obviously I'm going to start of with some questions -#include <windows.h>#include <GL/gl>#include <GL/glu>#include <GL/glaux>INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPST...
686 byte By
rba1988 at 2007-11-20 10:55:31
Here's a struct:struct ip6_hdr { union { struct ip6_hdrctl { u_int32_t ip6_un1_flow; /* 20 bits of flow-ID */ u_int16_t ip6_un1_plen; /* payload length */ u_int8_t ip6_un1_nxt; /* next header */ u_int8_t ip6_un1_hlim; /* hop limit */ } ip6_un1; u_int8_t ip6_un2_vfc; /* 4 bits versi...
364 byte By
errtime at 2007-11-20 10:55:37
im writing a simple program and i would like to make a few option tabs for it. For example, Open, Exit and Help. If i click on the apropriate name ( Open, Help or Exit ), program does what it should do.I am looking on the internet on my own as well, only thing what i have found is visual c++, but ca...
799 byte By
mr3d at 2007-11-20 10:55:40
I've got a function f1(x,a) and I need a function f(x)=f1(x,a1) being a1 a parameter entered by the user. Perhaps it is clearer with some code:typedeffloat (*tpfx)(float) ;float func1 (float x, int param) //function f1(x,a){...}float func2 ( tpfx f) //needs a pointer to a f(x){...}int main(in...
This is a small part of my program, I'm trying to allow the function "output" to run only when the conditions are true. But I'm getting an error [Declaration Syntax Error].How would work this?output()if ((b<=-1) && (c<=-1)){ //proper output, for instance: b = 3 or b = -3 "2x^2 - 3...
i dont see how iterators and [] operator differ. I am using them to cycle through a vector, and both seem to work. Which way is better, and how are they different.
459 byte By
Lanzo at 2007-11-20 10:55:55
hi, i just started taking a c++ class a couple of weeks ago and i've been trying to make some programs at home but Im having a problem. Every time i make a program in compiles fine and I go to run it and the dos window pops up and I enter the input and push enter and the dos window shuts out...
1232 byte By
prof101ar at 2007-11-20 10:55:57
This is kind of hard to explain, but I'll do my best to keep it simple. I'm trying to find the values of variables (a & c) when they are multiplied with -4 to equal 400. So that 20^2 (400) + -4ac = 0This is involved with equation ax^2 + bx + x = 0 The Discriminant of the quadratic formula...
1718 byte By
errtime at 2007-11-20 10:56:14
Hi, today i started to learn abt functions and already i have the 1st difficulties to face with.. my program must give an array to function and after function has done its work, it returns me another array. Ill give You my code, maybe u can tell me what i am doing wrong here :S#include <iostream&...
Hello m8s. I have one question that's bothering me. <br/>How can I check if certain file exists?<br/>For example, I want to write some default text to a file if prior to opening it didn't exist.<br/>Thanks in advance.
759 byte By
Jsteiner at 2007-11-20 10:56:22
Alright mates... this is my first post here because I finally found an assignment that really stumped me.Basically I want a loop that lets you input integers into a vector until a tube "|" is inputed and then continue with the program.For some reason... I cant make it work.while(cin>>x) //term...
Hi everyone,I'm using a Linux box, compiling with G++, and trying to print out an unsigned short. The algorithm I'm using is very similar to below:unsigned short value = 0x5555;unsigned short mask = 0x1000;while (mask){ if (mask & value) cout << "1"; else cout << "0";...
I'll Try my best to keep this simple."int a,c;"I'm trying to find the values of variables a & c when they are multiplied with -4 to equal 400. So that 20^2 + -4ac = 0 will be true. How would you do this?Here's what I've Got So Far, Please Help:#include <iostream.h>int main(...
4434 byte By
mrtn400 at 2007-11-20 10:56:34
EDIT: I believe the error that makes the app crash is in the first for loop located in the while (run==1) loopEDIT2: I continued messing with it and got it to work.Hello, I'm new to the world of C++. I recently tried to make a C++ console app for World of Warcraft. The first time the user runs...
Is there any way to print out the whole function stack inside a function?<br/>One way I know is to take the address of the funtion parameter and print some bytes around that.. I am **** sure there is much more efficient way to do the same...
Hello all,We are currently working on a client-server based application. The client is implemented in C++. However Server is implemented in JAVA.We need some common repository for both the implementation. I mean there are some entities such as enums or structures which are shared by both client and...
Hi all:I have heard about problems with std::string and STL classes using multithreading.I know there are libraries thread safe and others not thread safe. I use gcc with its own libraries (I think they are not thread safe but I'm not sure).Off course, if you share a string between two threads...
Sorry for pestering you friends again but again suffering from another problem ! please resove my problem , here i pictured my problem .<br/> http://img213.imageshack.us/img213/9231/problemsx6gi8.jpg
585 byte By
dave2k at 2007-11-20 10:57:18
i have many classes which derive from CImageCorrection. They all do various corrections such as red eye, brightness, etc...Currently they only work on 8-bit images, i.e. normal jpegs, but the customer now wants to add support for 16-bit images.Each algorithm is slightly different for the two differe...
182 byte By
tianqio at 2007-11-20 10:57:22
in c++, ++i is a lvalue which i++ is not.<br/>in c ,both i++ and ++i are not lvaue.<br/>can someone tell me what cause the difference, this really confuses me.<br/>thanks .
214 byte By
yaniv_av at 2007-11-20 10:57:23
Hi, <br/>Why the following code is wrong?<br/>typedef struct tagA<br/>{<br/> struct B<br/> {<br/> int x;<br/> int y;<br/> };<br/>}A;<br/>A a;<br/>a.B.x=1;<br/> <br/>Thanks !
1797 byte By
silje3 at 2007-11-20 10:57:29
Hi, I'm trying to make a program that prints rows and columns with asteriskses (*). The number is inputted by the user. The number of columns must be less then 80. Using a for loop, I either get the correct number of asteriskes, or the number of columns, not both! Can someone please help me wit...
Sup guys,I know some of you may be getting tired of me repeating the same question but I am just not getting the answer I want so I need to ask here...I know understand things such as how windows controls send their notification through a message known as WM_COMMAND and also understand how you need...
ok
Hey there, I am a student at San Jose State University and I am taking a C++ programming class. The only past programming I have had is .NET and this is my first time using C++. So, I am programming this project that is supposed to add a specified number of even or odd integers. The problem I am...
556 byte By
DaAvange at 2007-11-20 10:57:59
Hello, I would like to capture a screenshot of directX application window Since the normal screen capturing doesnt help me this time (atleast not on vista's DMW),By normal method I mean GetDesktopWindow, GetDC ,CreateCompatibleDC, BitBlit...Anyway I think its called (and what I need is to do)...
512 byte By
nerdykid at 2007-11-20 10:58:07
I have some code that lets u input text and a file argument, and then uses rot20 (just something to encrypt the text with) and exports it to the file argument. i also have some code that can read a file and decrypt it.i want to make it so that if the user already has a file, they can encrypt it usin...
Hey.I've finished a small program that uses the console and a window (using SDL library). I want to be able to run that program by opening it's release .exe via a shortcut. When I open the .exe out of my IDE, it opens and then closes straight away. When I run (CTRL + F5) it in my IDE it wo...
Whenever I have written template classes in the past, they have always been functionally simple, and so I have always implemented them in the header file. Now I want to do something a little more complicated, however, I have fallen at the first hurdle. The following compilation of an empty object wo...
2419 byte By
henrikbe at 2007-11-20 10:58:46
Hi!Let's say we have the following template class:template <typename T>class OutputTraits {public: static void print(T t) { std::cout << t << std::endl; }};Now we could write stuff like int i = 4; OutputTraits<int>::print(i); double d = 4; OutputTraits<double...
Hi all,I have recently asked this (very stupid sounding to me..who knows maybe it makes sense) question in an IBM interview.Suppose there is a abstract base class with n pure virtual functoins. Now suppose there is a class which derives from this abstract base class, but it does not define some of t...
Good day, im writing an proxy and i need to change an received packet ... i wrote this to test the packet change but i cant manage to make it work... im very new on this...what i need to do is copy the last 4 "o" hex vals (c3 81 6e 69) and replace the last "n" vals ( 00 00 00 00)thanks in advance.#i...
1336 byte By
muran at 2007-11-20 10:59:01
hey guys, just curious. in this question, why doesnt the PASS BY REF (&) make a difference ??this stack just swaps the top two elements in the stack but my question is regarding the PASS BY REF. if you remove it, it will still give you the same answer. i dont have this idea very clear yet about PASS...
471 byte By
Rooting at 2007-11-20 10:59:09
Hi friends.if I have an array in a struct :struct dev-archive { char array[MAX] }in main how can i pass the array in a function??..int main() { dev-archive obj; InitialingVector( ?? ); return 0x0;}int InitialingVector(char array[] ){ for(in...
I need to open and read the values written from a text file line by line then convert those values (I have this code written using input x already) and output them into another text file.To begin with, how would I open and read this text file line by line? Then how can I implement the values into my...
I'm having some troubles with memory usage while using std::map. In particular, I have a std::map as follows: typedef std::map<std::wstring, BOOL> innerMap; typedef struct { int nNum; std::wstring strString; innerMap innermap; } mapstruct; typedef std:...
I need to encrypt a paragraph out of a txt file.I can get the info from the txt file into a vector with no problem.But then I need to encrypt the data using this key "wyijkcuvdpqlzhtgabmxefonrs"Where each letter represents a letter in the alphabet. w = ay = bi = c and so on.My problem is I have nev...
1771 byte By
inbugable at 2007-11-20 10:59:49
#include "stdafx.h"int _tmain(int argc, _TCHAR* argv[]){//variable names int Int1, Int2, Int3, sum, average, product; //takes user input printf("input three different integers: "); scanf("%d%d%d", &Int1,&Int2,&Int3); //equation process sum = Int1 + Int2 + Int3; average = sum / 3; product = Int1 * In...