15,300 Posted Topics
![]() | Re: Your algorithm for that function is incorrect. According to [this article](http://en.wikipedia.org/wiki/Luhn_algorithm), you have to double every second digit. It's not clear from that function whether it is validating the account number or calculating a checkdigit. If you are validating the account number there is no need to calculate the checkdigit … |
Re: which line? >cin>>c>>endl; Line 21: endl can not be used cin, it's only useful for outpout streams, not input streams. | |
Re: depends on the operating system and compiler you are using. There is no standard way to change background color because that is a function of operating system. | |
Re: A complete reference is online at Microsoft's site MSDN (Microsoft Developer's Network). Just google for the name of the tool you want to know about. For example if you want to know about the editbox, then google for "msdn editbox" If you can spend some money then you can buy … | |
Re: 1. use a char variable char filename[255]; getline(cin,filename); ifstream in(filename); 2. read each line of the file. When a line is read search it for the desired text. In c++ you can use std::string's find() method. 3. You have to completely rewrite the file, leaving out the line you want … | |
| |
Re: fgets() read the <Enter> key into the buffer if the buffer is large enough to hold it. It's done that way by design so that the program can tell whether all the line was read or not. If the '\n' exists at the end of the line then the entire … | |
Re: line 81. After you enter a number and press <Enter> key, cin does not remove the enter key from the keyboard buffer. Then when getline() is executed at line 9 it sees '\n' in the keyboard buffer and removes it thinking that is the end of the text you just … | |
Re: CreateList just copies the input file to the output file, it does not retain any of the data or create a linked list. The loop starting on line 146 will do nothing because myHead is NULL. | |
Re: what compiler are you using? I compiled/ran with vc++ 2008 express and your first program worked ok. | |
Re: Happy birthday Dani :) :) My score was 55 WPM. Oh well, I don't type as much as I did 20+ years ago.When I was 30 I was doing about 100 wpm. | |
Re: Corrected function. nevsor_t is NOT a structure, it's a typedef, so you don't use the struct keyword with it. Also, there is no \* before ia->age because ia is not a double pointer. int sort_age(const void *a, const void *b) { nevsor_t *ia = (nevsor_t *)a; nevsor_t *ib = (nevsor_t … | |
Re: Implementing the add() function is pretty simple, just assign one of the elements of aNames and aNumbers from the two parameters. For example: aNames[i] = name.getname(); Is class Phonebook right? The find() method is supposed to return a reference to PhoneNumber class, but PhoneNumber is not in Phonebook. I'm thinking … | |
Re: _A_FUNCTION is not the same as _A_FUNCTION(), read [this article](http://gcc.gnu.org/onlinedocs/cpp/Function_002dlike-Macros.html#Function_002dlike-Macros) | |
Re: lines 16-23 are incorrect. The loop also needs to check for end-of-list so that it doesn't attempt to iterate past the end of the list when item does not exist in the list. currPtr = head; while (currPtr->next != NULL && currPtr->next->datum != item) { currPtr = currPtr->next; } if( … | |
Re: What's the question(s)? The code you posted doesn't even start to do the assignment. Hint: use fgets() instad of scanf() when you want to enter a string that contains spaces. For example: char name[255]; printf("Enter your first name, middle name, and last name\n"); fgets(name, sizeof(name), stdin); Another way to do … | |
Re: There are several ways to correct the problem: add using std::cout after the includes and before any functions, or on line 6 use std::cout | |
| |
Re: >First post here, please go easy on me :) Fat chance :) Move line 6 to line 3 so that it is not inside any function. Your program compiles without errors/warnings using VC++ 2012, as you already stated. It won't compile using Code::Blocks w/MinGW. I don't know enough about that … | |
Re: You mean you want to put a function in the output file? Why? Can't be done. You don't put executable code in the output file. Instead, you write a function that reads the output file and do whatever you need to do with the data. | |
Re: You mean Program A has a file open for reading, then Program B wants to write to that file? What I think you want is to synchronize two processes, see [these google links](https://www.google.com/#hl=en&tbo=d&sclient=psy-ab&q=synchronize+processes&oq=synchronize+processes&gs_l=hp.3..0l2j0i30l2.1904.7310.0.8734.21.11.0.10.10.0.96.801.11.11.0.les%3B..0.0...1c.1._GM4-GtdYBM&pbx=1&bav=on.2,or.r_gc.r_pw.r_qf.&fp=7bb9b384f427c1da&bpcl=38093640&biw=1487&bih=881) | |
Re: My guess is that procfile_read() is writing beyond the bounds of buffer parameter. Is buffer allocated enough memory to hold all those lines of text? Also, the loop on line 21 should be <index, not <=index because the loop starts counting at 0 and the value of index is initially … | |
Re: I think you are misunderstanding what that function is doing. It is only printing one word at a time, but it doesn't print a '\n' after each word. do this and each word should be on its own line. `cout << searchWords << '\n';` | |
Re: No they are not the same. Read [here](http://en.wikipedia.org/wiki/Adjacency_matrix) and [her](http://en.wikipedia.org/wiki/Incidence_matrix)e. | |
Re: what have you read that is confusing? Post a link, then ask a question. | |
I came across [this site](http://ynwlypmxhzyo.spotsoft.net/browse/search/?q=Microsoft+Visual+Studio) a little while ago tha is selling Microsoft Visual Studio for ridiculously low prices. Illegal copies or valid? | |
Re: line 52: FDOM hasn't been initialized to anything, so it just contains some random value. What compiler are you using? Learn to use your compiler's debugger so that you can easily find the mistakes in your program. | |
Re: What version of Visual Studio are you using? M$ dropped support for c++ Windows Forms in VS 2012. textbox.Text = "something" will set the text in a textbox, read [this link ](http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox_properties.aspx)for all properties/methods. So to make the calculation just convert the text in the textbox to an int, make … | |
Re: Which one, if any, of those you use will depend on how the cable is connected to the PC. Is it connected to LPT1, COM port, or USB? Most printers today are USB. | |
Re: when you shuffle the questions do you also shuffle the answers at the same time, that is, when a swap is needed you have to swap elements in both arrays so that the two arrays remain in the same order. Oh well, I just answered a dead thread :) | |
Re: Your function total() is incomplete. After declaring section c you need to populate its members with totals from a + b then you can calculate the sum as you have coded it. The sum can't be calculated until no_boys and no_girls are known. | |
Re: >I know only rand and srand but how to display these lucky/happy numbers and how to store 6dight numbers i array? Simple: just an assignment statement. Below is an example. int numbers[20]; for(int i = 0; i < 20; i++) numbers[i] = rand(); // now to display them for(int i … | |
Re: Does that also happen with other web sites? What country do you live in? Do you have an antivirus program always running? How much memory does your computer have? Does your computer have enough free hard drive space? | |
Re: It doesn't look like the file has been read at that point. main() just opens the file but doesn't read it into the patient and hospital arrays. | |
Re: >how to check if the name is in between 1 and 25 characters. I know I need to use the >, <, || operators, but I can't remember how to compare a string. Any he Just use std::string's length() method to find out how many characters are in the string. … | |
Re: Just take the original file name and append something to it std::string name = "Hello"; std::string newname = name + "There"; ofstream out(newname.c_str()); Or, if you want to keep the same name just put the new file(s) in a different folder by appending the new path to the folder to … | |
Re: Maybe [URL="http://msdn2.microsoft.com/en-us/library/ms235630(VS.80).aspx"]these short tutorials[/URL] will help | |
Re: >how we protect our files from others to modify them through programming You can't on MS-Windows. About the best you can do is encrypt the files, then when your program need to change the file decript it again. If you are running a version of MS-Windows that has NTFS file … | |
Re: Couldn't you buy it locally, on DVD? I have no idea what you can do other than what you have already done. My recommendation: stick with Windows 7, do not upgrade to Windows 8. I upgraded and now regret it becuse all the data on my hard drive is now … | |
Re: [QUOTE=cutterpillow20;1760561]Thank You for tha Information sir... but my problem that i can move/manipulate the cursor left, right, down, up in the output screen. Hope you can help me...[/QUOTE] He already told you how -- call gotoxy(). | |
![]() | Re: I voted for Micky Mouse for President and Popeye as VP. |
Re: you can do it in C, C++ or vb.net, use which ever language you already know and is able to call C language functions (which is most languages I know of). A more relevant question might be what gui libraries do you want to use. In c++ you could use … | |
Re: You need to initialize the array count_let to all 0's before calling that loop. You can do that when it is declared, like this: `int count_let[20] = {0};` Since you are reading the file one character at a time it is not necessary to read the characters into an array. … | |
Re: You could use this [URL="http://www.pdftoword.com/"]PDF to Word converter program.[/URL] | |
Re: The way I have done this in the past is to put a linked list of Citizens inside the District structure, something like below. Note that unless you were instructed to do otherwise you don't need both a CitizenNode and a Citizen structure, just one or the other. struct Citizen … | |
Re: get [MinGW](http://sourceforge.net/projects/mingw/files/), but I don't know which version of gcc it uses. | |
Re: Can you only enter alph characters such as 'a' to 'z', no caps or other special characters? >for(int value = 0; value < strlen(userInput); value++) calling strlen() in a loop like that is poor programming practice because the return value never changes and its time consuming. Here is a better … | |
Re: >LadderLogic is rightfully a language in itself. Yes, I agree with that, I used to work for a company that installed large character printers and scanners on production lines in factories. Devices that used LadderLogic language were often used to bridge the gap between computer and production line hardware, such … |
The End.