49,761 Topics

Member Avatar for
Member Avatar for camcam08

i have an error on this code i cant open example.txt using my declarations. #include <fstream> #include <iostream> #include <string.h> #include <time.h> #include <string.h> using namespace std; int main() { char time[9]; char date[9]; _strtime(time); _strdate(date); string nop; nop = "example.txt"; ofstream dtfile(""nop"", ios::app); dtfile<<time; dtfile<<" "<<date<<endl; dtfile.close(); }

Member Avatar for mrnutty
0
79
Member Avatar for come_again

Hello everyone, I don't have much experience with C++ and it has been a while since I have last used it. Right now I am writing my own class for quaternions. My problem which I cannot figure out is what is wrong with the operator overload shown below... No matter …

Member Avatar for StuXYZ
0
169
Member Avatar for Bigbrain99

when i tried to compile it, why i got expected primary-expression before input? [CODE]#include "mylibrary.h" #include "contadd.h" //for function declaration void Contact::setname(string name) { ofstream myfile; myfile.open(CONTACTS); if (myfile.is_open()); { myfile<<name<<endl; myfile.close(); } i++; } int main(int argc, char* argv[]) { vector <string> input; Contact addingname; if (argc == 2) …

Member Avatar for Bigbrain99
0
331
Member Avatar for enkidu75

I need to write a program for class. I'm not necessarily looking for code, just help. I need to file input data in this format: 01 - 00:53 - 70 01 - 02:45 - 50 01 - 03:31 - 79 01 - 04:30 - 56 01 - 05:55 - 59 …

Member Avatar for mrnutty
0
113
Member Avatar for gaishi

Hello, everyone I just wrote a program by using vc 2010 and it won't compile. The reason was 1>------ Build started: Project: 17, Configuration: Debug Win32 ------ 1> 17.cpp 1>c:\users\yuan\documents\visual studio 2010\projects\17\17.cpp(101): warning C4244: '=' : conversion from 'double' to 'float', possible loss of data 1>17.obj : error LNK2019: unresolved …

Member Avatar for NicAx64
0
191
Member Avatar for Bigbrain99

When i tried to compile it, it gave me this error "no match for operator". Any idea how could this happen? This program will take user input and add it into dat file [CODE]#define CONTACTS "contacts.dat" #include <iostream> //enable the used of cin and cout #include <fstream> //enable writing file …

Member Avatar for Bigbrain99
0
224
Member Avatar for ranvi

Hi All, I need your help regarding valgrind issues. I have pasted a snippet of code, (not compilable version) which gives the idea of what I am doing. Basically, I have a parent and child process. Child process is running infinite loop (server). Parent process at the end, kills the …

0
55
Member Avatar for mike42intn

I am trying to make this project and im very new to this but i really want to learn this can anyone check this code for me and tell me whats wrong with it. I have to get it to add 2 fractions display result then display result in decimal …

Member Avatar for mike42intn
0
151
Member Avatar for clb8372

[CODE]For each of the following problems, use the top-down modular approach and pseudo code to design a suitable program to solve it. 1. Input names of students from the user, terminated by ZZZ, and create a data file GRADES with records of the form: student (string), test1 (integer), test2 (integer), …

Member Avatar for UnderAshes2008
0
502
Member Avatar for gianks

Hi all, i've to make an introduction of what am i doing before start making questions. The goal of my work is to create an application quite like an IDE, for specific program development ( always in C++ ) and testing. Since the need of execute these programs under the …

0
129
Member Avatar for Bigbrain99

currently I'm building a program which can take people contact and add it to a dat file. However, when I tried to run the program, i got this error: invalid types ‘<unresolved overloaded function type>[int]’ for array subscript [CODE] class Contact{ private: int phones; string email; string name; public: void …

Member Avatar for Bigbrain99
0
5K
Member Avatar for taylar

I want to learn C++ but there are so many poroblem in undersatnding this. plz send me some places list where i can learn C++ so fast... Thnks =============taylar [URL="http://autotradeinsurance.com"]Auto Trade Insurance[/URL]

Member Avatar for creeps
-1
126
Member Avatar for NordCoder

I am making an Asteroids clone using SDL and OpegGL in C++. Like most games, I needed to render text and after some hassle with SDL_ttf, I decided to try FTGL which uses Freetype2. I am using Visual Studio C++ 2008 Express Edition. There is no precompiled library included in …

Member Avatar for NordCoder
0
601
Member Avatar for jay-tee

i have use a column of called driverIdnumber and have a Date of birth in a new column using ID number of the driver,please help katimaDM - is my data module katimaDM->tblDriver->edit(); katimaDM->tblDriver->field->fieldbyName("DriverDOB")->AsAnsiString = ............//this part im lost katimaDM->tblDriver->post();

Member Avatar for jay-tee
0
82
Member Avatar for ymb6

1. Discuss the concept of arrays of objects. Give examples (10 marks) 2. Write a program to get the average of 10 random numbers given by the user (10 marks) 3. List and describe the arithmetic operators available in C++ (5 marks) 4. List any benefits of Object Oriented Programming …

Member Avatar for Fbody
-3
279
Member Avatar for prit05
Member Avatar for Duki
0
177
Member Avatar for whelhelmsoriano
Member Avatar for sfuo
0
76
Member Avatar for michdd

I'm trying to create some type of callback system for events. I have a function where I'm attempting to set a member to a pointer to a function but I'm receiving an error. This is what I attempted to do: [CODE]void (MyClass::*test)() = &MyClass::TestCallback; EnterButton->SetCallback(test);[/CODE] And then in the class …

Member Avatar for mike_2000_17
0
186
Member Avatar for mommabear

[COLOR="Green"]Hello I've just joined this forum, although I have used it regularly in the last couple of months to help in my learning of programming. I have learned a lot (I feel), and I'm now hoping to not only resolve the errors I have in my coding, but to gain …

Member Avatar for mike_2000_17
0
346
Member Avatar for kenn1213

Im not really in the major of c++ or I.T i need your help [B]The Fibonacci Sequence it must lead the sequence 0,1,1,2,3,5,8,13,21.... A program that will generate a Fibonacci of a specified length given the first 2 numbers in the sequence. First input an integer N that specifies the …

Member Avatar for kenn1213
0
172
Member Avatar for dflatt

i keep having a problem with my arrays. when i set them up and try to re-use them elsewhere i only get the last part of the array and all the rest are pointers. [CODE] typedef int* ptr; ptr sub;//dynamic int count = end - start; //the sub-array's size is …

Member Avatar for dflatt
0
70
Member Avatar for HumanBeing86

here is my codes, i plan to output the name and the weight. but no matter i try many time it still give me an output only output should be this-> Name = Meow Weight = 10.5 whereas what am I getting is Weight = 10.5, why? thx [CODE]#include <iostream> …

Member Avatar for vijayan121
0
142
Member Avatar for Bench

For anyone who gets fed up with the somewhat verbose syntax involved in populating an STL map container with static arrays of std::pair (Or any of the other somewhat tedious ways of writing 'pair' combinations), here is a function which allows two different (statically allocated) arrays, of equal length, to …

Member Avatar for vijayan121
0
2K
Member Avatar for HumanBeing86

hmm....why I can't get the output?? any wrong ?? thx for helping... #include <iostream> using namespace std; const int SIZE = 3; class Course { string* students; public: Course (string* students); ~Course (); void print(); }; Course::Course (string* students) { students = new string[SIZE]; for(int i=0; i<SIZE; i++){ students[i]=Course.students[i]; } …

Member Avatar for NicAx64
0
152
Member Avatar for HumanBeing86

Hi all... I am a new c++ learner. I'm facing a little problem. according the code below I try to display the output from the loop... but no matter how I trying it still can not work.... here is my codes... anyone can tell me which part am I wrong …

Member Avatar for Fbody
0
136
Member Avatar for embooglement

I'm developing a game engine, and set up a function that uses string streams to convert various values into std::string's. To use this to string function on class obviously takes an overloaded insertion operator, which I have done for a transformation matrix class here: [code] typedef std::stringstream StreamString; StringStream& operator<<(StringStream& …

Member Avatar for embooglement
0
2K
Member Avatar for clarkeboy

How Can I use Clear screen and jump to next line?? like for example. press enter y for yes and n for no to proceed to next line and next screen.

Member Avatar for GuitarComet
0
187
Member Avatar for archana.c07

Hi all, I am trying to implement singleton class having static method. my requirement is as below: A.h Class A{ Public : Static A* getInstance(); } B.cpp #include A.h Class B : public class A{ A* A::getInstance() { //some code. Return *A } } D.cpp #include B.h A* pter = …

Member Avatar for archana.c07
0
98
Member Avatar for new_tonio

Q: Can anyone estimate what is the running time(average or approx) in minutes on getting one knights tour using recursive backtracking on a P4@2.2Ghz? i'm running my code in a pc with core2duo2.0Ghz and it is running for 13hrs up to the time i started this thread... thanks

Member Avatar for tesuji
0
55
Member Avatar for mrkaran

i have a piece of code: [CODE] struct myKeyword { string name; int id; }; myKeyword keywords[]={{"include",INCLUDE}, {"void",VOID},{"main",MAIN},{"int",INT},{"float",FLOAT},{"cin",CIN},{"cout",COUT},{"if",IF},{"elseif",ELSEIF},{"else",ELSE},{"exit",EXIT},{"for",FOR},{"while",WHILE}}; int j=0; cout<<keywords[0].id; //not able to access keywords.id part flag=0; for (j=0;j<11;j++) { if (lexeme==keywords[j].name) { temp->assign(lexeme,keywords[j].id); flag=1; break; } } getchar(); }[/CODE] why cout<<keywords[0].id is not working? thanks in advance

Member Avatar for mrnutty
0
126

The End.