49,761 Topics
| |
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(); } | |
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 … | |
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) … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
[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), … | |
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 … | |
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 … | |
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] | |
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 … | |
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(); | |
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 … | |
i want to develop a parallel thread based application , so which is best language for it?? | |
hello i want to create a C++ program in this view 1 2 3 4 5 6 7 8 9 | |
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 … | |
[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 … | |
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 … | |
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 … | |
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> … | |
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 … | |
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]; } … | |
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 … | |
| 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& … |
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. | |
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 = … | |
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 | |
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 |
The End.