15,300 Posted Topics
I hate the Office 2007 menu ribbon -- it is really awful and difficult to navigate such simple things as Open, Save, and Edit. Anyone know if there is a way to make the menus look like older versions of Office? | |
Re: malloc(), calloc() and realloc() are C functions to allocate memory, although they can be used in C++ it is preferable to use the new operator. The two (malloc() and new) should not be used together in the same program. resize() is NOT a C or C++ function, but is often … | |
Re: There is no such thing as c++ windows class in windows.h -- its all pure C code. There have probbly been in excess of 1,000 Microsoft programmers who wrote those win32 api functions. | |
Re: What do you mean you want to change the stream to something else? What do you want to change it to? | |
Re: Join their mailing list and ask them. Nothing like getting the info straight from the horse's mouth ([URL="http://www.phrases.org.uk/meanings/336400.html"]American joke [/URL]- sorry if others don't understand it.) | |
Re: Yes of course its possible. >>Can we treat these files as if they all are readable in binary mode? Yes, but you may not have permissions to do that. That is an operating systems problem, not C or C++. How to actually read those files is a different matter altogether. … | |
Re: go to amazon.com and search for "web development" books. Also [URL="http://lmgtfy.com/?q=web+deveopment+tutorials"]look here[/URL] for tutorials | |
Re: Do you know how to open a file and write to it? You can put the " character in the file by using the escape sequence \". [code] #include <fstream> using std::ofstream; int main() { char *string1[] = {"a1","a2","a3","a4"}; char *string2[] = {"b1","b2","b3","b4"}; ofstream out("filename.csv"); for(int i = 0; i … | |
Re: A technique I have used is to use another int array that represents the index values of the original array or vector. Sort the vector as normal but instead of swapping vector values you would swap the index array values. You could use std::sort() for this if sort the index … | |
Re: By itself it means absolutely nothing. In 16-bit compilers such as Turbo C it is sometimes necessary to hardcode memory addresses, such as the screen on MS-DOS is located at 0x8000 (or something like that). So it might be necessary to cast a pointer to that address [icode]char* screen = … | |
Re: The only time \\ is needed is for string literals, like one you posted because the compiler has to interpret each of the characters in the string literal. When the path is typed in from the keyboard of read from a file the \ does not have to be escaped … | |
Re: In the example line you posted, position 13 is the letter 'E', (in MET), not 'N'. And pos 24 is '1' (in 916). ![]() | |
Re: what do you mean by "cursor base"? How to move the set the screen cursor (that blinking black line or square where you type)? That will depend on the operating system you are using. | |
Re: Should be not very complicated. Just read the files in a loop [code] #include <string> #include <fstream> #include <sstream> int main() { std::ifstream in; for(int i = 1; <= 100; i++) { std::stringstream s; s << i; std::string filename = "a.out"; filename += s.str(); in.open(filename.c_str()); if( in.is_open() ) { std::string … | |
Re: I know it sounds fun to code it in assembly, but you would be better off using your time to learn a higher level language such as c, c++, c#, php, etc. There is almost no need for assembly programmers any more. | |
Re: Use <map> and you won't have to be concerned about duplicates. Or sort the vector first to make it easier to find duplicates. The operator< on line 20 will not work correctly because it will never reach the two lines that test for y (lines 24, 25 and 26 are … | |
Re: Nice instructions -- but what do you want to know about them? I hope you don't want anyone to write the program for you because we don't do that. | |
Re: First -- thanks for using code tags correctly on your first post here. Nice code, but why did you post it? | |
Re: >>if (choice3=='89') '89' is not 'Y'. There is no such thing as 89 within single quotes. Your compiler should have given you an error or warning on that, which I have to assume you ignored. [icode]if(choice3 == 'Y')[/icode] is what you want. But what if you type 'y' instead of … | |
Re: >> how can i delete the previous lines in the file and write a new lines You will have to rewrite the entire file. It's not possible to insert new lines somewhere in the middle of a text file without rewriting it. You already have the vector, so just interate … | |
Re: First you have to declare an object of type FLATMATE and then push it onto the vector [code] FLATMATE fl("John"); myvector.push_back(fl); [/code] | |
Re: sorted lists means the items are in alphabetical or numeric order, unsorted means they are in just some random order. | |
Re: you mean it won't compile? What compiler and operating system? | |
Re: In alloc_vec(), new_vector_ptr is just an uninitialized and unallocated pointer that points to some random memory location. You have to allocate memory for it before it can be used for anything. [code] Vector *alloc_vec(void) { Vector *vector_ptr = new Vector; // <<<<<< Here vector_ptr->size = 0; vector_ptr->array = NULL; vector_ptr->array … | |
Re: don't use a loop. [URL="http://faydoc.tripod.com/cpu/stosb.htm"]See this link[/URL] [code] mov ecx,4096 mov edi,offset ??? xor eax,eax ; set eax = 0 rep stosb [/code] You can inprove the performance of that a tiny bit by using stosd and storing in ecx the count of dwords instead of bytes | |
Re: In USA you can copyright software simply by putting copyright statement at the top of the source code (in comments of course). I don't know a thing about India. | |
Re: How do you recognize one paragraph from another? There is no standard way to separate paragraphs like there is to separate lines. So your first task is to clearly define what constitutes a paragraph. Counting the number of '\n's is counting lines, not paragraphs. So you will have to think … | |
Re: VB can not call the methods that take c++ classes as parameters or return values, such as std::string. And VB will have to call the methods by their mangled names as generated by the c++ compiler. | |
Re: Pass by reference allows one function to change the value of a variable that is declared in another function. For example, put the following into your compiler, compile and run it. Then you will see how pass by reference works. More in-depts explaination is [URL="http://cplus.about.com/od/learning1/ss/references.htm"]here[/URL]. [code] #include <iostream> void foo(int& … | |
Re: If you wrote the program as MS-Windows GUI, such as it uses WinMain() instead of main(), then that link error tells me that you created the wrong kind of project. You should have started with a Win32 Project, not a Win32 Console Application (assuming your compiler is VC++ 2010). | |
Re: You will probably have to ask whoever you got that library from. | |
Re: A c++ vector is just the c++ implementation of a normal array. So when the instructions tell you there are exactly 8 floating point values in the vector, that means declare an array like this: [icode]float values[8];[/icode] If you are confused about how to use arrays then read one of … | |
Re: Each node in the linked list will contain the information for one student. First create a structure with all the information you want about a student then add a next pointer for the linked list. If you need more information then you will have to be a lot more specific … | |
Re: To add a node at the end of the linked list the function will have to start at the head and iterate until it finds the last node -- which will be the node where the next pointer is NULL (or 0). Once that node is found just set the … | |
Re: >>'Clean All Targets' (which I think is a complete rebuild?). No it doesn't mean that. Clean means to just delete all the files that are generated by the compiler, such as *.obj, *.o, *.lib, *.dll, *.pch, etc. | |
Re: Did you try [URL="http://lmgtfy.com/?q=assembly+sort+"]this[/URL]? | |
Re: As a retired 23 year veteran I have to agree that the game should be banned from every store in the USA. The game is an insult to every American who died in wartime. If I see a copy of it I'm afraid I will have to burn it in … | |
Re: We can't help you if you don't post the code. And tell us the exact error message -- what unresolved symnbol? You will get that if you put a method in a class but not the method's implementation code. | |
Re: Create a new project then copy (with Windows Explorer) the *.cpp and *.h files from the other two files into it. Then in the Solution Explorer window of VC++ 2010 right click "Source Files" and from the popup menu select Add --> Existing Item. Or, if I misunderstood what you … | |
Re: I down voted you just because of the crazy/childish title you gave this thead. Otherwise what can I say except that the code you posted is horribly formatted. On positive note -- you used code tags correctly on your very first post :) I would probably have up reped you … | |
Re: Just because entries has room for 20 items don't assume that all items were used. What happens to that sort algorithm is only 2 items were actually used? You need another counter to keep track of the number of items actually used in that array. Then that sort() function will … | |
Re: you can not use sizeof to get the number of bytes allocated to an array. All sizeof(any pointer here) does is give you the size of a pointer -- on 32-bit compilers it will be 4. There are two solutions I can think of: 1. Use vector instead of array, … | |
Re: You are using VC++ 2010 on MS-Windows but attempting to run a *nix ls command???? On MS-Windows the equivalent of ls is dir. >>strcat(ps,psBuffer); You will have to initialize ps to 0 before that line. Do it when it is declared, [icode]char ps[1024] = {0};[/icode] I think it would be … | |
Re: It is initializing each array element with random numbers between the two values you see. | |
Re: [URL="http://lmgtfy.com/?q=c%2B%2B+sort+algorithms"]Link[/URL] >>plz let me find a simple code Bubble sort algorithm is as simple as it gets when you have to write your own algorithm. Otherwise you can just use std::sort() that's found in <algorithm> header file. | |
Re: How to erase the screen is operating system dependent. The simplest way to do it is [icode]system("cls");[/icode] or for *nix [icode]syte("clear");[/icode] But both those are not recommended because they can intoduce your program to hackets. | |
Re: Its all about something called the "comma operator" [URL="http://en.wikipedia.org/wiki/Comma_operator"]Here[/URL] and [URL="http://msdn.microsoft.com/en-us/library/zs06xbxh(VS.80).aspx"]Here[/URL] are two more links | |
Re: >>would prefer it to be standard C++ not visual studio C++ VC++ is a compiler, not a language. [code] #include <windows.h> int main() { HWND hWnd = GetConsoleWindow(); ShowWindow(hWnd, SW_MINIMIZE); // rest of program goes here [/code] | |
Re: Please post the first few lines of the csv file so we have something with which to test your program. |
The End.