15,300 Posted Topics
Re: Red color tags do work. just use the [noparse][color=red] ... [/color][/noparse] color tags. Other colors don't work though. [code] [color=red]This is in red[/color] [u]This is underlined[/u] [color=red][u]This is underlined red[/u][/color] This is not in red. [/code] If you use [noparse][code] ... [/code] the above will work as shown. But if … | |
Re: I didn't get any warnings or errors when I compiled that code with vc++ 2010 Express. Check your code very carefully -- there might be an extraneous character somewhere. AFAIK that compiler should work ok on XP. | |
Re: When you set up the edit control you told it that you wanted it to be a numeric value by checking the numeric property. When you did that MFC will not permit it to be blank -- it must have a number. If you want it to be blank then … | |
Re: >>how can i solve the data files's problem By writing the program of course :) What have you already written? What don't you understand about the instructions? | |
Re: The *.pch file is of no use outside the project that created it. Its only purpose it to speed up the compile process of a project. What you have to do is add the *.lib file to the project. There are two ways to do it: 1) Put this in … | |
Re: what compiler are you using? For MS-Windows and Microsoft compilers, use winsock2.h and link the program with ws2_32.lib. Windows does not support Berkley sockets. | |
Re: Any predictions of world disasters?? Earthquakes, hurricanes, tornadoes, huge sun spots, earth hit by large asteroids, etc. | |
Re: From the description I would think you need to read the numbers from a text file, not from the keyboard. | |
Re: >>Im interested in IT, what are my chances of working my way up? If you live long enough you will outlive everyone else. Eventually you will be CEO :) | |
I previously posted an MS-Windows example program about how to recursively search folders and create a list of their filename. This program is similar in concept but is for linux. It c++ and uses std::string and std::vector classes to hold the strings. When the program encounters a directory it will … | |
Re: I don't follow golf -- afterall its no more a sport than computer programming or brain surgery. Anyone can play golf, whether sober or intoxicated; as long as your not passed out you can play the game. ![]() | |
Re: [code] if(i<n) c[k++]=a[i++]; else if(j<m) c[k++]=b[j++]; [/code] You need to loop through i and j until i == n and j == m. Note that the if statements are not needed. [code] while(i<n) c[k++]=a[i++]; while(j<m) c[k++]=b[j++]; [/code] >>for(loop=0;loop<--k;loop++) Change <-- to just <. You don't want to change the value … | |
Re: [URL="http://www.cplusplus.com/forum/general/6813/"]Read this[/URL] If you use MS-Windows you can use your 32-bit compiler to read the file if you use win32 api file/io functions instead of std::fstream. AFAIK there are no 64-bit implements of fstream for 32-bit compilers. | |
Re: [code] float CalculateFee(float time) { float charge = 2.0F; if( time > 3.0F) { charge += (time-3.0F) * 0.50F; if( charge > 10.0F) charge = 10.0F; } return charge; } [/code] | |
Re: 1. You should have used code tags when you posted that stuff. No one is going to read that unformatted code. >>How can I replace my buffer using malloc which reads unlimited line Use a linked list. | |
Re: I perfor { and } on separate lines, inline methods/functions when they consist of only one or two lines, and int main() instead of void main() [code] #include <iostream> using std::cout; int main() { if( somethod ) { cout << "Somethig here\n"; } else { cout << "Something else here\n"; … | |
Re: you must mean Turbo C++, not Turbo C. But I don't know why you can't code it in c++. If you expect to get that project done in a week then you will have to work a lot of hours each day -- not much time left for play. | |
Re: >>Turbo C can display only 16 colors so I will need to use a Windows Interrupt[or something like that] to display the image. Not with that compiler you won't. That compiler can not access any of the win32 api functions. Get a 32-bit compiler such as either Code::Blocks or VC++ … | |
Re: Looks like you are doing it the hard way [code] int n1,n2,n3,n4,n5; while( map >> n1 >> n2 >> n3 >>n4 >> n5 ) { // do something with these numbers } [/code] | |
Re: [URL="http://msdn.microsoft.com/en-US/library/6d5tahbt(v=VS.80).aspx"]Read this[/URL]. Call the control's GetTime() method, which returns a SYSTEMTIME structure. That structure contains what you are looking for. | |
![]() | Re: >>char *argv[100]; You need to initialize all those pointers to 0, like this: [icode]char *argv[100] = {0};[/icode] Why are you typing in /bin/ls? Doesn't it work with just "ls", like you would type it in the shell? [edit]I tried it just now and it doesn't work either. Not sure what … |
Re: Add another pointer -- call it tail or something -- that keeps track of the last node. Then when you need the end of the list it will be easily available without taking the time to traverse the entire list. | |
Re: >>but how can I keep reading it, line by line? That's the purpose of the while statement that you posted. Every time fgets() is called it will read the next line in the file. The "!= NULL" says to keep reading until end-of-file is reaches or some other error occurs. … | |
Re: >>for (i = 0; i < n;++i){ What will happen if you only input 3 numbers? Answer: the final value of sum will be in the crapper because it will add in uninitialized array elements 4-20. | |
Re: Post code because we can't see your monitor. | |
Re: include <string> >>stdev= pow(sum,0.5); sum is a float, but 0.5 is a double. There are no overrides of pow() that take those parameters. change 0.5 to 0.5F to make it a float. | |
Re: >>lab=&(*lab)->next; That is destroying the original pointer. Use a different pointer to iterate through the linked list and leave the original pointer unchanged. Something like the code below (not compiled or tested). You didn't post the definition of struct information, so I'll just assume it contains no other pointers than … | |
Re: Probably something like this (untested) code [code] #include <fstream> #include <vector> #include <string> #include <sstream> using namespace std; int main() { std::vector<std::string> elementVector; std::ifstream in("filename.dat"); std::string line; while( std::getline(in, line) ) { if( line == "<et>" ) { std::getline(in,line); stringstream st; st << line; std::string word; while( std::getline(st,word,''' )) { … | |
Re: Create a timer event -- see MSDN for SetTimer() and OnTimer() methods. | |
Re: If you want MS-Windows then probably have to use one or more of the [URL="http://undocumented.ntinternals.net/"]Undocumented Windows API functions[/URL] | |
Re: Why not just use MS-Word or Open Office to modify the doc file? | |
Re: post the code you are writing. Are you allowed to use the math coprocessor for log and other math functions ? | |
Re: why do you need a 1000X10000 array? Another way to do that and simlify it is to create a structure then make an array of structures [code] struct item { vector<int> numbers; int linenum; }; vector<item> items; [/code] | |
Re: You should also get 0 credit if someone else writes the program for you. | |
Re: bool, true and false are c++ keywords. Just comment out that enum and it should work ok. | |
Re: inside the loop that starts on line 50 keep track of the student who has the highest score. Do this by saving the value of the i loop counter into another variable. For example: [code] int highest = 0; for(int z=0;z<list.size();z++) { total+=list[z]->score; if( list[z]->score > list[highest]->score) highest = z; … | |
Re: character arrays like that can not be returned by any function, whether its in a dll or not makes no difference. You have several options [list=1] [*]Since this is c++ return std::string -- this may have the same problem as described below for #3 [*]add a char array parameter to … | |
Re: I assume you mean on the MS-Windows operating system instead of *nix or MAC. Well, if the program is written in ancii C or C++ then your list shold be empty because the program should compile on all c or c++ compilers. | |
![]() | Re: Welcome to DaniWeb. It's not how old you are when you start but how well you can think and solve problems. I was almost twice your age when I started. |
Re: First you have to have mysql server installed on your computer. Then you have to link that program with the mysql.lib that is in the mysql server install directory. | |
Re: Have you created the database and tables yet? What's the name of the table, and whats the names of the columns? You need to learn the SQL (Structured Query Language). google for tutorials. Briefly, if you want to insert a row into a table INSERT INTO tablename VALUES(1,2,3,4,5) Where 1,2,3,4, … | |
Re: by "protected/unprotected code" to you mean "managed/unmanaged code" ? Maybe you should contact NUnit to iron out the problems you have with it. I never used it so I can't help you with it. | |
Re: Sounds like you have some studying to do in order to make up that week in the hospital. Your text book probably covers all the material you need to do the program. Start out very simply -- define the class. | |
Re: [code] scanf("%c",&words[i]);} atoi(&words[i]);} [/code] above is useless. just input the text as normal characters. You don't have to do any conversion at all to get the ascii value of the characters -- data type char already contains the ascii value. To see if its odd or even [code] // get … | |
Re: You will have to rewrite the entire file. Rea the original file into memory, append the data in memnory, then rewrite the file with the new lines. | |
Re: Do you mean how to sort a 2d array based on just one of its columns? For example if you have an array of ints that has 5 columns and 1,000 rows, how to sort it by the contents of column 2 (or some other number) ? | |
Re: You are doing it the most diffiult way possible -- reading the file one character at a time. Words are separated in files with white space (spaces and/or tabs). ifstream has >> operator which reads entire words [code] std::string word; ifstream input(filename.c_str()); int counter = 0; // check that file … | |
Re: int 21h, ax = 09, writes the string in dx to the screen. You would have known that if you had bothered to google for "int 21h". | |
Re: I'm having a wonderful time living since I retired from programming a little over 3 years ago. Life is sooo much easier and better. I wake up every day without a care in the world. Even though I still work part time (non programming) I never bring my work home … |
The End.