15,300 Posted Topics
Re: We're not going to do your homework for you. (1) if the head is NULL -- this is a simple assignment statement. allocate memory for the new node then assign its pointer to the list's head. (2) head already exists: You want to add the new node to the tail … | |
Re: 1. Learn to use code tags. The code you posted is almost impossible to read without them. 2. What is the problem with your program? What does it not do that you want it to do? Are there any compiler errors? If yes, then what are thy? | |
Re: how is sign and RsvrdWrd declared? As for the extra character -- why don't you try reading the file into std::string object then copying the info to the RsvrdWrd. [code] void loadR() { ifstream file; std::string line; file.open("C:/CaseStudy/CaseStudy/Rsrvd.txt",ios::in); for (i=0; i<44; i++) { getline(file, line); strcpy_s(sign[i].RsvrdWrd, 12, line.c_str()); //file.getline(sign[i].RsrvdWrd,13,'\n'); } … | |
When you move a thread here in DaniWeb Community Feedback I wish the mods would leave no redirect links. Its rather annoying to see all those moved threads, they just clutter up the list with useless links. | |
Re: In WinProc() cature the [URL="http://msdn.microsoft.com/en-us/library/ms646242(v=VS.85).aspx"]WM_RBUTONDOWN[/URL] event. lparam contains the mouse coordinates. | |
Re: I used to read it, but have not seen the link with this new design. I posted a complaint about that but I suppose it got lost in the shuffle. There used to be a link at the bottom of each page, near the About Us line. | |
Re: The NULL character is '\0', or just simply 0. Use while loop to check each character in the string. | |
Re: Very intereting :) >> and he is confident in Intel's ability to generate plenty more cash. Who said we are in a recession? Apparently Intel isn't. I hope they are putting all that cash to good work that create new jobs instead of just putting it under their mattress for … | |
Re: You can get handles to all windows, which ones would have .mpp files I don't know. See win32 api function [URL="http://msdn.microsoft.com/en-us/library/ms633497(VS.85).aspx"]EumWindows()[/URL] | |
Re: Interesting. On MS-Windows I get the same results that you got on Solaris, which is correct. That book is wrong. The operating system may read into memory any amount of the file it wants to (buffering), but the file pointer only moves to the location requested in the program. There … | |
Re: >> It should be a multiple of 4 bytes. Depends on the compiler and how it aligns the structure object. You can change the alignment with most modern compilers so that it is 1, 2, 4, 8, 16, 32 etc aligned. The default alignment is compiler dependent too. | |
Re: Q1: That doesn't work because what you have to do is extract each of the digits from an integer. If you enter 1234 then you have to count each digit 1, 2, 3, and 4. Use the % (mod) operator and / to do that. This isn't the complete code … | |
Re: I see that is an MFC program. What version of the Microsoft compiler are you using? If you want anyone to test out your program you need to zip up the entire project directory and upload it here (us the Advanced Editor options to do that). But first delete all … | |
Re: sleep() takes whole integers. You can't pass 0.99 and expect it to do anything because 0.99 is converted to just 0. If you want to sleep less than one second then use nanosleep() | |
Re: Not specific to MFC. Just add .5 and take the integer part [code] int main() { float f = 1.67F; f += 0.5F; f = float((int)f); std::cout << f << '\n'; } [/code] | |
Re: check_month() is incorrect. November has only 30 days, not 31. class data objects: I think all you need are current_day, current_month, and current_year. You don't really need any of the others. add_years() for example should be coded like this: [code] //add years to default date void add_years (int num_years) { … | |
Re: You mean the + operator? [code] class MyClass { private: int x; public: MyClass() {x = 0;} MyClass operator+(int x) { MyClass n = *this; n.x = n.x + x; return n; } }; [/code] | |
Re: >> number%10 = dig1; That is backwards. [icode]dig1 = number % 10;[/icode] | |
Re: I would get the input data as a string, then check each character to see that it is a numeric digit 0-9 or a . for floats (and there can be only one dot in the string). If it passes that test then convert the string to a float. | |
Re: The file is probably not in the current directory. either use getline() so that you can enter the complete path to the file, or move the file into the current working directory, which is where the *.cpp file is located. Also make sure you spell the file name correctly -- … | |
Re: Did you read [URL="http://msdn.microsoft.com/en-us/library/ms646977(v=VS.85).aspx"]this?[/URL], especially [URL="http://msdn.microsoft.com/en-us/library/ms647988(v=VS.85).aspx"]InsertMenuItem[/URL]() | |
Re: Your program is also inconcistent in the way it declares std namespace. If you don't use [icode]using namespact std;[/icode] or [icode]using std::vector;[/icode] then you have to preface every instance of vector with std::, such as [icode]std::vector< std::vector< std::string> > something;[/icode] As for the parameter tokens -- unless that is an … | |
![]() | Re: >>I would like to use this tasklist for a cli interface and then change it to a GUI AFAIK CLR is only supported by c++, not C. So you might as well switch to c++ now if your intent is to use it in a c++/clr project. |
Re: [QUOTE=linta;1010975]plz help me 2 finish my c++ proj on supermarket.i need the exact details of the funcns,sub calculatns............. urgent[/QUOTE] How urgent is this? Deposit $100,000 USD into my paypal account and I'll help you out. | |
Re: With the loop counter declared as unsigned short what will your program do if n_elements is 0? I would think that declaring the loop counter as int would be a lot safer. If n_elements is an unsigned int then you might want to typecast it to int in order to … | |
Re: You can not use graphics.h with that compiler. If you want to draw curves then you will have to [URL="http://www.phrases.org.uk/meanings/bite-the-bullet.html"]bite the bullet[/URL] and learn win32 api programming, or learn MFC. | |
Re: Is there a reason you are using strings instead of simple integers? It would be a lot simpler to manipulate an integer then convert it to a string for display purposes. [code] #include <stdio.h> #include <string.h> int main () { int x = 39989; char result[80]; for(int i = 0; … | |
Re: Oh so now you insult 99.9% of today's young people :) I see you are becoming very popular here at DaniWeb where most members are below the age of 25. | |
Re: It's [b]Pig Latin[/b], not piglakin. Read [URL="http://en.wikipedia.org/wiki/Pig_Latin"]this wiki article [/URL]to see how to convert English words into pig latin. It will not give you the c/c++ code, but will show you what you have to do. | |
Re: It's not necessary to store all the even numbers. All you have to do is add the value of the loop counter to the sum accululator if the loop counter is even. | |
Re: how about writing your own browser? Nothing fancy that will compete with IE6 or Mozilla. | |
Re: Read about the format specifiers! The 2 in %2d says to display the integer in 2 or more characters. For example if x = 1, then it will show a space before the 1, like in " 1". But if x = 123 then it will just show all the … | |
Re: You might find something useful [URL="http://www.lvr.com/usb.htm"]here[/URL] | |
Re: Is is a console or gui program? How are you displaying the number? If you are displaying floats then use fixed [code] #include <iostream> #include <iomanip> using namespace std; int main() { float x = 1000000000000000.0F; cout << x << '\n'; cout << fixed << x << '\n'; } [/code] | |
Re: [URL="http://lmgtfy.com/?q=how+to+write+a+bootloader+in+c"]Start here[/URL] | |
Re: Assuming you have a pure win32 api program, send [URL="http://msdn.microsoft.com/en-us/library/ms632627(v=VS.85).aspx"]WM_GETTEXT[/URL] message. | |
Re: .bmp files are binary files, not ascii text files. You have to open the file with ios::binary flag and then use ifstream's read() method to read the binary data. getline() will not work. And you will have to read the file into a character array, not a std::string object [code] … | |
Re: I'm not surprised. All you posted is a bunch of meaningless lines of code. Try writing a real program with functions etc. | |
Re: it doesn't work because you have to use sprintf() to format the string. [code] char command[255] = {0}; sprintf(command,"copy %s.jpg \\%s\\%s.jpg" , a, a, a); [/code] | |
Re: Even without optimization it will be compiler dependent. You can test that out for yourself by having your compiler generate the assembly code and see for yourself what it does with it. [code] int main() { int x[5] = {1,2,3,4,5}; int* p = x; p++; p = p + 1; … | |
Re: what compiler are you using? Most modern compilers have debugging facilities that let you execute the program one line at a time and view the current value of variables. | |
Re: instead of "0x" for hex use use "0o" for octal, which is consistant with "%0o" in the printf() format specifier. | |
Re: Since you are using MFC then call [URL="http://msdn.microsoft.com/en-us/library/49313fdf(VS.80).aspx"]SetTimer()[/URL] The last parameter is the name of the function you want it to call. See the example in the link. | |
Re: ODBC is the way to go if you want a program to be able to connect to a variety of SQL-compliant databases, such as Access, MySQL, Oracle, Sybase, etc. etc. See the links that Narue posted. But if you have a specific database in mind then you might get better … | |
Re: Is it possible to do what? There is no restriction on the number of getters you can put in a class.And you have to put { and } around all functions even if they are only one line. I always make one liners inline code instead of in an implemnentation … | |
Re: It only prints the last name that was input because when cin >> name is called cin will erase the current contents if name and replace it with the new keystrokes. If you want to keep all the names in memory then you will have to put them in an … | |
Re: scnaf(%s stops processing keyboard input when it encounters the first space. If you want to include space when use fgets() instead of scanf() [code] fgets(name, sizeof(name), stdin); // now remove the trailing carrage return '\n' if( name[strlen(name)-1] == '\n') name[strlen(name)-1] = '\0'; [/code] |
The End.