49,766 Topics
![]() | |
I'm self-teaching myself C with a complete reference book. Unfortunately that means that the author assumes that the reader is familiar with fundamental concepts and doesn't bother commenting the code. Here is an unnecessarily obfuscated code excerpt demonstrating "the use of return statements" along with my attempt to understand what … | |
Below is my crazy program.What i want it to do is that it should take two arrays from the user;the 1st array should be the memo & the 2nd should be answers.These two arrays should be passed to function compare of the type bool.In compare the 2 arrays should be … | |
Hi, I am new to this web site and new to C++ programming. I am still in school and learning everyday. I am not catching on to some things so I was wondering if one can Help me. My problem I am working right now has to do with averaging … | |
Can anyone figure out why I get -9.032654e something from my biWeeklySalary function? [code] #ifndef EMPLOYEE_H #define EMPLOYEE_H #include "HireDate.h" #include <string> using std::string; class Employee { public: Employee(); Employee( const string &, const string &, const string &, const HireDate & ); ~Employee(); void setFirstName( const string & ); … | |
Hi, I just installed the latest version of Visual C++ from Microsoft on a windows XP system. I have used this program before, but this time, on my new install, when I try to compile, I'm getting an error, "c:\documents and settings\user\desktop\r\listdbl.cpp(1) : fatal error C1083: Cannot open include file: … | |
I have instantiated an object, bob, and have an array with hours for each day bob has worked. When I try to call bob.biWeeklySalary( hours[] ) it doesn't work. I'm not really sure how to use the array here. The compiler just says that hours is an undeclared identifier. Your … | |
I have executed the below programm on both C and C++ compiler and got different results [CODE]#include <stdio.h> int main() { const int a=10; int *p=(int*)(&a); *p = 20; printf("address of a=%u\t%d\n", &a,a); printf("address of p=%u\t%d\n", p,*p); return 0; } [/CODE] With C compiler I got the output address of … | |
Hi, i'm new to C++ (well actually i just haven't looked at it in awhile) and I've been trying to figure out how to make my array's content depend on a condition. It's not extremely important, but I think there's got to be an easier way than what I'm using. … | |
I am getting this error in the second constructor for Class MailCarrier. mailcarrier.cpp(11) : error C2512: 'Employee' : no appropriate default constructor available I'm trying to incorporate composition and inheritance into my program. :idea:Any help would be appreciated:idea: [code] //MailCarrier.h #ifndef MAILCARRIER_H #define MAILCARRIER_H #include "Employee.h" #include <iostream> using std::cout; … | |
Hi I’m getting compile errors in the following code: [code] void Driver::read_data() { ifstream infile("data", ios::in); string name, surname; while (infile >> surname) { infile >> name; Person temp(infile); temp.read_surname(infile); temp.read_name(infile); temp.read_phone(infile); temp.read_age(infile); temp.read_weight(infile); 87 person_map[surname][name] = temp; } } [/code] The errors tell me that 87 driver.cpp instantiated from … | |
Hi everyone. I’m having some problems:mad: debugging the following code: [code] typedef map<string, map<string, Person> > pclass; pclass::const_iterator i; map<string, Person>::const_iterator iter; pclass person_map; void Driver::add_record() { string surname, name, phone, age, weight; int new_age; double new_weight; cout << "Enter name: "; cin >> name; cout << "\nEnter surname: "; … | |
[code] #include <iostream> using std::cout; using std::endl; #include <cstring> using std::strcpy; using std::strcat; #include <cstdio> using std::sprintf; int main() { char * lb = "(?:[a-z90](?:-?[a-z90]+)+)"; int lbLen = strlen(lb); char * sbFrmat = "(?:%s(?:\\.%s){0,4})"; int sbFrmatLen = strlen(sbFrmat); int sbLen = (lbLen * 2) + sbFrmatLen; char sb[sbLen+1]; sprintf(sb, sbFrmat, … | |
Hi, I was wondering if anyone could help me. I'm constantly getting the following compiler message: 138 driver.cpp 'class pclass' has no member named 'surname' 138 driver.cpp 'class pclass' has no member named 'name' on the following lines: [code] 138 for (i = person[surname][name].begin(), i != person[surname][name].end(), ++i) { 139 … | |
I am writing a program to calculate my paycheck. I am including in this program two functions to calculate sickleave and vacation leave. I have a hireDate data member in the format of mm/dd/yyyy, how would I figure out length of employment to calculate aquired vacation and sick leave? I … | |
[code]# include <iostream> # include <stdio.h> # include <conio.h> # include <dos.h> # include <string.h> # include <math.h> # define TRUE 1 # define FALSE 0 //if you can change to a class it can be better and faster struct member { int mid; char mainname_1[20],madd[30]; struct Read_Struct { int … | |
[B][I][COLOR=Blue]if you run this code in c++ you get the following error at the underlined part is where the problem is : error C2143: syntax error : missing ';' before 'constant' : fatal error C1004: unexpected end of file found Error executing cl.exe.[/COLOR][/I][/B] [CODE] # include <iostream> # include <stdio.h> … | |
Hi guys I am new to C++ and need urgent help with this part of my code for a uni coursework I have to submit by Thursday [code]//ClientData.h #ifndef CLIENTDATA_H #define CLIENTDATA_H #include <string> using std::string; class ClientData { public: // default ClientData constructor inline ClientData( int = 0, string … | |
C++ Code: [code] /* readmail.c */ #include <stdio.h> #include <stdlib.h> #include <windows.h> #include <windowsx.h> #include <mapi.h> #include <string.h> int readmail(); long err; LHANDLE lhSession; lpMapiMessage FAR *lppMessage; lpMapiMessage lpMessage; char szSeedMessageID[512]; char szMessageID[512]; char szTmp[4096]; char szTmp2[50]; LPSTR lpszSeedMessageID=&szSeedMessageID[0]; LPSTR lpszMessageID=&szMessageID[0]; int main() { readmail(); return(0); } int readmail() { … | |
Ok im learning how to do exponents in c++ and I get most of this, but I dont get what double means. I do however know what float is. in the deffenition of double from my compiler help it says "double - a double-precision floating point value." but i dont … | |
could someone please provide me with the answersd to the following c++ problems, they are simple problems which are probably an insult to most of your intelligence but i'm clueless and desperate. THANKS FOR HELPING:o 1. how would you write this expression in c++? assume all variables are of type … | |
Hi ppl, I have made a declaration: char* str; str = " Hi there"; what do i have to do to extract a substring from this? [I]Thanks,[/I] [I]Ishwar[/I] | |
Can anyone suggest me a nice and easy to use C/C++ compiler under Windows.. Give the URL from which I can download. Thanks in anticipation... | |
I get a segfault when I run the following. Seems to fail at strcpy. [code] #include <cstring> using std::strcpy; int main() { char * word = "word"; strcpy(word, "what"); } [/code] If I change char * word to char word[], it's fine. I thought that both declarations effectively do the … | |
Ok My Code Is Fine As My Friend Can Compile It Fine So I Wont Show That. My Error Is This [CODE] 1>LINK : fatal error LNK1104: cannot open file 'odbc32.lib' [/CODE] I Have SDK Installed And Visual C++ 2005 With MSDN | |
[CODE]#include <stdio.h> struct FUN { char x; char *y; int z[20]; }; int main(void) { struct FUN fn1; struct FUN fn2; struct FUN fn3[10]; struct FUN fn4[50]; return 0; }[/CODE] is an assignment like fn4[23] = fn3[5] invalid? | |
I'm trying to create the code for a paycheck program where I am paid double time for anything over 10 hours, time and a half for 8-10 hours and straight time for 0-8 hours. For some reason the pay isn't accumulating correctly. Any help would be appreciated. [CODE]#include <iostream> using … | |
Does Any One Know If Theres A Way To Use C++ With Html? | |
Hello everyone, I am trying to get an XTEA algorithm to work. I read the key from another process of which I'm sure it has a valid key at a specific location in memory. My encryption algorithm seemed to work, but when I tested it by making a buffer, encrypting … | |
Hi , ppl, I want to get the absolute file path of my c++ app, I tried searching through io.h, but alas , I don't know what the function is.:sad: I am using Dev C++ under Windows. [I]Thanks a lot, [/I] [I]Ishwar[/I] | |
I am using c++ and need to devise a method to determine the check digit of a credit card. The user enters the card no. as a string. The card no is then divided into blocks of length, x. these blocks are then added. I have the code to convert … |
The End.