15,300 Posted Topics
Re: This is nothing more than a stupid rehash of [URL="http://www.daniweb.com/forums/thread118131.html"]another thread[/URL] that was already answered. No point in doing it again. Just read the previous thread to get the answer. | |
Re: It would be nice if you explained what this program is supposed to do. Given the input file what is the output file supposed to look like ? | |
Re: you declared [b]outputLegend[/b] as [b]const[/b] array but trying to pass it to a function that expects non-const. Change the function to require const [code]void printTxtArray(const char *B[]);[/code] | |
Re: >>what do i do next Start by testing the word to see if it begins with a vowel. You will probably want to write a series of if -- else if --- else if --- statements to test each of the requirements. | |
Re: The post count on all my threads are the same. You probably need to refresh your browser page. | |
Re: Nobody is going to do your homework for you without pay. Put $1,000.00 USD in my paypal account and I'll write it for you. Otherise, post what you have done and we'll go from there. | |
Re: did you try this: [icode]sprintf(buff, "%ld", lval);[/icode] | |
Re: >>Can anyone help with it Not really. Your are probably using the wrong compiler and/or operating system. Just comment out that line and see what errors you get. You might have to define some stuff yourself. | |
Re: I know that compiler does not support MFC but you might browse [url]www.codeproject.com[/url] because they probably have an mfc combo box class that does something like that and will give you ideas how to do it with win32 api functions. | |
Re: line 15: delete it because its not needed. Your logic in that while statement beginning on lines 26 to 50 is all screwed up. Here's the correction which is a lot less code than what you have. [code] int tempTotal; stream1 >> tempExamID >> tempTotal; aExam.examid = tempExamID; aExam.total.push_back(tempTotal); while … | |
Re: You can use std::sort() algorithm and write your own comparison function for it. [URL="http://msdn2.microsoft.com/en-us/library/ecdecxh1(VS.80).aspx"]Here is an example[/URL] And you can find more information in [URL="http://www.google.com/search?hl=en&q=std%3A%3Asort"]these google links[/URL] | |
Re: Q1: knowledge of c++ is only the beginning to writing a program like the one you posted. It also requires several years of very intense study of hardware and software Q2: Depends on how knowledgeable you are in the field of compiler design. Many people with Ph.D have written their … | |
Re: >>toUpper() You don't have a function by that name in the code you posted. | |
Re: >> 'vector' : undeclared identifier Don't you think that should tell you something about your program? Did you look to see where [b]vector[/b] is declared? Just in case you really have no clue you have to include <vector> header file. | |
Re: lines 9, 10, and 11: I thought this was supposed to be c++, not C ?????? So why are you writing C-style code in a c++ program? [code] cout << "Enter the keyword"; cin >> keyw; cout << "Enter the key"; cin >> key; [/code] | |
Re: copy it to a temp array then copy however you want [code] unsigned char tmp[sizeof(int)]; int x = 123; memcpy(tmp,&x, sizeof(int)); // now you can copy tmp array the way you want to [/code] | |
Re: You would save yourself a lot of trouble by learning to use [URL="http://www.csupomona.edu/~dlbell/cppexplanationsfa99/23.html"]google[/URL]. which found that link in just a few seconds. | |
Re: How do you <snipped link> with pencil & paper ? If you know that then doing it in C or C++ is trivel. | |
Re: >>i am new around here Not with 22 posts under your belt If you were banned you wouldn't be able to make this post. As for the color of your name -- looks normal to me. | |
Re: line 3: wrong function parameters. There are only two valid ways to code that function: [icode]int main(int argc, char* argv[])[/icode] [icode]int main()[/icode] You will have to change all the lines that reference [b]sc[/b] to use [b]argv[1][/b] instead. Or you could just add another variable and leave the rest of the … | |
Re: [URL="http://www.newobjects.com/pages/ndl/SQLite2%5CSQL-OleDate.htm"]Here is some infor[/URL] If using MS-Windows c++ program and you already have a DATE (double) object, then you can call [URL="http://msdn2.microsoft.com/en-us/library/ms221440.aspx"]VariantTimeToSystemTime[/URL] to populate a SYSTEMTIME time structure which you can then use however you wish. | |
| |
Re: when you enter a non-digit cin will set the error flag so all you have to do is test for it [code] if( cin.error() ) { cout << "ERROR ..."; cin.clear(); // clear the error flag } [/code] | |
Re: convert to string then insert the commas [code] #include <sstream> #include <string> using namespace sd; int main() { int n = 4200; stringstream stream; stream << n; string str; stream >> str; // now insert the commas in the appropirate spot // I'll leave that up to you to figure … | |
Re: That saves it as binary data, so you can not view it with Notepad. If you want it saved as text then convert with CString [code] CString s; s.Format("%d", r); ar << s; [/code] | |
Re: You have to use TurboC or TurboC++ compilers to use either of those links. graphics.h is obsolete and not supported by all other compilers. I don't really know the answer to the question but I think it will be pretty complicated. [URL="http://filext.com/file-extension/JPG"]Here [/URL]is the jpg file format and [URL="http://www.google.com/search?hl=en&q=jpg+file+format"]here [/URL]are … | |
Re: #1: get rid of that [b]goto[/b] statement (lines 12 and 52)-- its a sure way to get an F on that program. To exit the do loop when -1 is entered, add this on line 17: [icode]if( size < 0) break;[/icode] line 47: isn't 0 a valid input value? If … | |
Re: 1. The header file should not have any code -- just function prototype [icode]extern short int DetectSensor(int sensorvalue[10]);[/icode] Notice the semicolon at the end and there are no ( and ) 2. In the *.cpp file, enclose the name of your header file in quotes [icode]#include "MySensor.H"; [/icode] Angle bracks … | |
Re: That may sound simple, but it isn't. Drawing objects such as lines, elipses etc can be very complicated depending on the operating system and compiler. | |
Re: ok, here is example code [code] void print(int x, int y) { cout << x << " " << y << "\n"; } void calculate( int* meanx, int* meany) // The two parameters are pointers to the integers that // are declared in main() { *meanx = 1; *meany = … | |
Re: 1. Learn to format the code better so that you and others can more easily read/understand it. Don't be afraid to make liberal use of spaces and tabs. Aligh each { with matching } and don't put the all at the same place. 2. Recognize repeating code and try to … | |
Re: [code] [color=red]Grade ** [/color]AddGrade(Grade ** _numGrades,int& _students) { _students++; Grade ** gradeTemp=new Grade * [_students]; for(int i=0;i<_students-1;i++) gradeTemp[i]=_numGrades[i]; [color=red] delete[] _numGrades; return gradeTemp; [/color] } [/code] or use a reference [code] void AddGrade(Grade **[color=red]&[/color] _numGrades,int& _students) { _students++; Grade ** gradeTemp=new Grade * [_students]; for(int i=0;i<_students-1;i++) gradeTemp[i]=_numGrades[i]; [color=red] delete[] _numGrades; … | |
Re: The parameter to getc() is a FILE pointer, not a char. Please read the [URL="http://www.hmug.org/man/3/getc.php"]man docs[/URL] before attempting to use standard C functions. | |
Re: [QUOTE=B|enderZa;574921]you'll prob never want to see my incode comments, LOL .[/QUOTE] If they look like your first post 3 years ago then your teacher may mark down your grades. Write for others as well as yourself. | |
Re: We're not going to get into yet another flame war on this topic. One is not better or worse than the other. Which one to use depends on the application. | |
Re: I always just use [icode]cin.get()[/icode] because it doesn't need a variable. This function should not beclared as [b]inline[/b] because the compiler will likely ignore that request. [b]inline[/b] code is normally reserved for one or two line functions, and compilers do not have to honor it at all. [code] float* Eccentricity(float … | |
Re: of course its not necessary to use classes or structures. fstream can and frequently does work with POD (plain old data) types. | |
Re: Look at line 18: That is an infinite loop. Delete it and your program won't loop back. | |
Re: >>Can you do this at all Sortof. What you do is write a public Initialize() method for class A so that it can be called by the class constructor as well as by anyone else. [code] class A { private: int x; public: A() { Initialize(); } A(int w) {x … | |
Re: Try [URL="http://www.daniweb.com/forums/thread94878.html"]this one[/URL]. | |
Re: line 10: That function doesn't take any parameters. It should be identical to line 48 but with a semicolon at the end. | |
Re: use getline() to read each line of the file then a loop to iterate through the string [code] std::string line; while( getline( infile, line ) ) { // make changes not shown // outfile << line << "\n"; } [/code] | |
Re: I've seen this identical problem just a day or so ago. Nice you posted your homework problem, now what is it that you expect from us? I don't have my crystle ball at the moment so I can't read your mind. | |
Re: You are writing an MFC program so surly by now you have learned to read the MSDN docs for each of the MFC functions you use. You do know about that don't you ? [URL="http://msdn2.microsoft.com/en-us/library/9c36ed1d(VS.80).aspx"]Read this[/URL] and you will find the function you are looking for. | |
The End.