15,300 Posted Topics
Re: Forget Turbo C -- its too old. Code::Blocks might work since it used MinGW which is the same compiler that's probably used on *nix, only the compiler was ported to MS-Windows, and it supports many of the *nix standard libraries. | |
Re: Start here: [code] #include <stdio.h> int main() { // your code goes here } [/code] | |
Re: line 67: amic is an ininitialized pointer. | |
Re: [b]string[/b] resides in std namespace and you have to tell the compiler what namespace it's in. You have several options (use only one of the options listed below) [list=1] [*] [icode]using namespace std;[/icode] put that after the include files (least desireable option) [*] [icode]using std::string;[/icode] put that after the includes … | |
Re: You can't just simply add gui to a console app. Start out by creating an MFC application (not a console app that supports MFC, but a regular MFC program, then choose either dialog (probably what you want) MDI, or SDI. After the gui app is generated, compile and run it … | |
Re: [QUOTE=Antwane;472017]how do I create a calender program using c++?[/QUOTE] If you were "smarter than a 5th grader" then you could just simply "copy" from the previous poster. But be aware that if he is also wrong you will have to post "I Antwane am NOT smarter than a 5th grader." … | |
Re: add [icode]using std::string[/icode] after the include files Move the code gards (lines 4 and 5) up before the include files. | |
Re: line 71 contains a syntax error. See if you can find it. | |
Re: Post the code that shows the error. | |
Re: line 105: >> else if (j = 51) You are using the wrong operator. Use boolean == instead of assignment = operator. | |
Re: You mean like this? [code] char c; while( c != '\n' ) { // blabla } [/code] | |
Re: You must be using old version of visual studio. The current version does not use pointers, but the ^ operator [code] List<String^>^ List1 = gnew List<String^>; // etc [/code] Upgrade to either 2008 or 2010 so that you can use newest version of C++/CLR language. As for your question, probably … | |
Re: [URL="http://www.codeproject.com/KB/library/GomzyHTMLReader.aspx"]Here is a c++ HTML reader class[/URL]. | |
Re: In getInput() the first thing you need to do is check if the file was opened. Next, don't use eof() because it doesn't work the way you think it does. [code] int getInput(studentType studentData[30], ifstream& indata, ifstream& infile) { infile.open("data.txt"); if( infile.is_open() ) { index = 0; read = 0; … | |
Re: Here is another way [code] if( file.is_open() ) { int n, x; float f; file >> n >> x; // get first line setM(n); setX(x); MatrixHandler data(n, n); while( file >> n >> x >> f ) // process remaining lines { // fill in the matrix here } } … | |
Re: Yes because MFC doesn't know a thing about std::string. CString is the data type used by MFC to transfer strings from member variables to/from the MFC controls, such as edit box. There is a lot of code in the CView derived class that will be broken if you just simply … | |
Re: I did not get an error using vc++ 2008 express, compiled for both C and C++ and was ok. So if you have an error then either it is your compiler or you didn't post something. | |
Re: No. Proof: [code] int main() { int* n = new int; cout << *n << "\n"; } [/code] | |
Re: Not really my "favorite", but Wanted is a very very good action movie. If you liked Die Hard you will also like Wanted. I suppose my favorite was Dune. I wore out two tapes because I watched it so many times. | |
Re: To get a random number between 1 and 6: [icode]int num = 1+ (rand() % 6)[/icode]. The rest of that function you should be able to do yourself. | |
Re: It's pretty simple, just create an infinite loop. Inside the loop get current time ( time() in time.h ), convert to tm structure ( localtime() ), then just print the hour, minute, and second). How to set the computer's clock will depend on the operating system. | |
Re: You can not simply insert stuff into existing lines of a text file. Instead, you have to completely rewrite the file. Open the original file for reading, open a new temp file for writing. In a loop, read each line of the original file and rewrite it with desired changes … | |
Re: >>Is there anyway to achieve this? No because the #inc lude directive is processed at compile time, not runtime. | |
Re: Not surprised by your problem because the code you posted won't compile. You can't run a problem that is just full of crap. | |
Just installed 64-bit Windows 7 Home Premium. So far so good. I did a fresh install, reformatted the hard drive, and installed fresh. | |
When I hit the Edit button to edit a post there is another active Edit button. Can you remove that button because its confusing. | |
Re: you could have just used stringstream to split the line into words without re-reading the file. And it would have been more useful to use vector to hold the lines/words. [edit]I don't see any reason at all for reading the file one character at a time. Too much work just … | |
Re: C++/CLR (Forms) is just another way to write windows gui programs. The original method, using win32 api functions, is still useful. Here's a common [URL="http://www.winprog.org/tutorial/"]beginner's tutorial[/URL]. | |
Re: This minor change made it work when I move first [code] if (choice==1) //if player wishes to go first { bool done = false; do{ cout<<"\n turn = "<<t<<endl; HumanMove(Board); w=CheckWin(Board); if (w==1) { cout<<"Youwin!"; done = true; } else if (w==2) { cout<<"You lose!"; done = true; } else … | |
Re: single characters take ' and ', not " and ". [icode]if( y == '1' )[/icode] | |
Re: You don't need either of those two programs. To edit a text file just completely rewrite it. Open the original for reading, open a new file for writing, in a loop read a line from the original file, edit it as necessary, then rewrite it to the output file (or … | |
Re: cout only works with text buffers -- your buffer contains binary information and most likely the very first byte is a 0. | |
Re: >>I'm new to using Visual Studio. I'm currently using VS .NET 2003 on Vista Upgrade to VC++ 2008. You can get free Express version. CLR and MSDN was changed quite a bit since 2003. Not sure why direct.h could not be found. Did you use angle brackets instead of quotes? … | |
Re: Its a lot easier to sort them if you use an array of 3 integers instead of 3 individual variables. [code] int arry[3] = {0}; for(int i = 0; i < 3; i++) { cout << "Enter an integer\n"; cin >> arry[i]; } // now you can easily sort the … | |
Re: There are no standard C or C++ functions that will do what you want. Bu8t there are some non-standard functions in conio.h, if that has been implemented by your compiler. You could also probably use something like ncurses library, or other win32 api functions. | |
Re: Did you try deleting all object files and recompiling everything? If that doesn't work then post the offending source file. | |
Re: OMG! Is that some sort of failed attempt to sort the array??? There are lots of sorting algorithms, had you bothered to google for any of them. [URL="http://www.fredosaurus.com/notes-cpp/algorithms/sorting/bubblesort2.html"]Like these[/URL]. | |
Re: I've looked at the assembly code quite a bit and have found it contains very little "useless junk". But you can have it produce assembly code listing if you want. Look in the c++ options and there you will see it. Unless you want to hand-code the entire program you … | |
Re: Function add() -- second parameter must also be passed by reference. You are just passing the pointer by value, which does nothing in main()'s copy of the pointer. Note the second parameter should have two stars, not one. [code]int add(int* index, int **a) { } [/code] lint 49: The typecast … | |
Re: [QUOTE=BestJewSinceJC;1051978]Not to be repeating myself. . but call of duty came out recently. .[/QUOTE] I suppose that means playing a game is more important than doing homework. | |
Re: I have only seen a couple of incompatabilities -- one of my games that played ok on Vista Home will not play on Win7. Also, the other day I bought a blue-ray video that contained a file that I could copy to my pc. Guess what?? It won't recognize Win7. … | |
Re: There are two problems on each of those lines 1) one, two, three, etc are not defined in that function. 2) [b]char[/b] is a data type, but you failed to provide a variable name. For example [icode] char something = 1;[/icode] [edit]What ^^^ said too :) | |
Re: vector doesn't have a find() method. Maybe what you want is std::map instead of two vectors. | |
Re: you can not convert an integer to character array like you tried to do. Use sprintf() instead [icode]sprintf(t, "%ld", i);[/icode] | |
Re: >>if (length=breadth) you are using the wrong operator -- use == boolean operator instead of = assignment operator. >> shape= 'square'; Two problems with that line [list=1] [*] All strings (two or more characters) have to be enclosed in double quotes, such as "square" [*] variable [shape] can only hold … | |
Re: On my computer Alt+2 generages '☻', not ^B | |
Re: >>Vector2<float> m_pVec2Stage[150]; Most likely that line. vectors are by definition arrays. So all you probably need is this: [icode]Vector2<float> m_pVec2Stage;[/icode]. But of course we can't be certain because we don't know how Vector2 was implemented. The only reason I can think of to use the above construct is if yiou … | |
Re: why not just put the number of records in the file followed by all the records. Or just read one record at a time until end-of-file -- you don't need the number beforehand. | |
Re: Using TurboC++ is like riding horse&buggy on todays interstates or autobahns (in europe). Ditch the horse&buggy and get a free modern ferrari. | |
Re: First you have to define the term "microarray data". We are programmers, not biologists. |
The End.