15,300 Posted Topics
Re: >>In my code I'm using the caret symbol for the square but it just multiply the number by 2 and not squaring it. Of course it doesn't work for you-- that isn't what the carret symbol does in c and c++. you have to use the * symbol and simply … | |
Re: The prototype on line 4 is incorrect. Its not the same as the actual function you coded. | |
Re: >>I'm ill and tired. My face is sweating - rest of me is shivering Hope you get over that cold soon -- I'm just now recovering from one. It'll probably be another month before I can get a flue shot. We're pretty big on flue shots over here. Here in … | |
Re: The loop beginning on line 8 will never ever execute more than once because of the return statements on lines 16 and 18. >>&& 2 == b - a ==> line 23 That will not work when the value of a > b. You need to consider someone entering 5 … | |
Re: >>anyone can help me Probably yes -- post your code and we'll see if someone can help figure out your problem | |
Re: 1. Delete line 15. 2. Delete the semicolon at the end of line 16 3. No need for variable [b]count[/b] so delete it on lines 6, 10 and 18. 4. initialize value of [b]number[/b] to 0 on line 5 because its used on line 11. | |
Re: what is main.bin? I never heard of linking a *.bin file with *.o files. >> Since I can't use nasm to make binary files with EXTERN's And why not? Its the linker that resolves the externs, not the assembler. | |
Re: [QUOTE=lasher511;418031]my favorite would have to be this one. [URL]http://youtube.com/watch?v=NSzsfadjaQo[/URL] But this one would be a close second. [URL]http://youtube.com/watch?v=STPFvrQEdXY[/URL][/QUOTE] The first one was pretty funny -- the second pretty boring; didn't watch all of it. | |
Re: >>why? where did you declare [b]hash[/b] ? I think it is probably declared in one of the boost libraries. | |
Re: Huh? 1000000*1000000 is a number that is much larger than an integer can hold. Otherwise your question doesn' make much sense to me. | |
Re: >>if(a < b && c && d && e && f && g) Do you know what that statement does? It first checks if a < b, then if that is true it checks if c != 0, if that is also true it checks if d != 0, etc. … | |
Re: >>Hello sorry if i hijack this thread for my own purpose Please don't do it again. I split your thread this time for you for free :) Line 5 is incorrect. Arrays are numbered from 0 to, but not including, the value of N. You should use the < operator, … | |
Re: >>Why doesn't it look good? Because why should I bother to answer here when you might already get answers elsewhere, and you might get conflicting answers at that. ![]() | |
Re: Just how does this relate to c++? It sounds like a question for [b]Web Development[/b] forum. | |
Re: I don't know why you are doing this the hard way with all those variables. All you need are three variables named Hours, Minutes and Seconds. To print them out with two digits each is like this: [code] printf("%02d:%02d:%02d\n", Hours, Minutes, Seconds); [/code] After getting keyboard input for the seconds … | |
Re: If you replace ShellExecute() with CreateProcess() the caller process will get a handle and can then call WaitSigngleObject() to wait until the spawned process terminates. | |
Re: ODBC doesn't work directly on wireless (embedded) devices running Microsoft Pocket PC or Mobile 5.0 operating systems. There is at least [URL="http://www.odysseycruises.com/index.cfm"]one commercial dll[/URL] that will allow mobile devices to send data back and forth to database, but it is quite costly. There is a free DLL from Microsoft that … | |
Re: It uses recursion -- if you don't know what recursion is then you won't understand how the program works. Other than that, it is a poorly written program. | |
Re: In a word processor when you hit the <Enter> key the cursor will move one line down and all the way to the left margin. That is what the '\n' character simulates in text files. When you load a text file that contains newlines in Notepad or some other word … | |
Re: you mean like this? [code=cplusplus] #include "stdafx.h" #include <iostream> #include <string> using namespace std; void enterData(string &todaysDate, string& firstName, string& lastName, double& amount); void printCheck(string &todaysDate, string& firstName, string& lastName, double& amount); int _tmain(int argc, _TCHAR* argv[]) { string todaysDate; string firstName; string lastName; double amount; enterData(todaysDate, firstName, lastName, amount); … | |
Re: [URL="http://www.cplusplus.com/reference/iostream/istream/get.html"]The get() function [/URL]will get exactly the number of characters you specify unless it first encounters the '\n' in the file or end-of-file. Line 20 is asking for 14 characters and that's exactly what you'll get. In the example line you posted it will read "K G Johnson 45", which … | |
Re: The loop at line 123 is incorrect. Should be coded like this because eof() doesn't work the way you think it does. [code] while(accountInfo >> accountNumber >> dOrC >> transaction) { accountNum[count] = accountNumber; dOrCArray[count] = dOrC; transactionAmount[count] = transaction; count++; } [/code] | |
Re: [QUOTE=fzafarani;443243]Hi guys, i have one question, when i type using namespace std; at top of my program my compiler gives some error especially syntax error! my compiler is Borland C++ v.5 for example simple code: [/quote] When using the old headers with .h extension you don't use "using namespace std". … | |
Re: lines 39 and 42 are wrong. The array only has 5 elements and you are attempting to access a 6th element -- won't work. And line 39 should use the loop counter variable like you did on line 30 and elsewhere. ![]() | |
Re: >>and what is "int" by the way. I am a little confused its a data type. Suggestion: read your text book occasionally. | |
Re: use the functions in time.h. >> dont know how to store the time/date so that it can be compared with current date/time use the time_t (normally an unsigned int) that is returned by time() for that. initialize a time_t object when starting then get it again in another variable, then … | |
Re: functions must be declared before they can be called. Your previous post contains the function prototype -- why did you delete it? | |
Re: >>since it is an online class it is hard to get help Naw -- there's lots of help here at DaniWeb :) Appears you have declared variables firstName and lastName incorrectly -- should be declared as std::string instead of char. The way you have it those variables can only hold … | |
Re: [QUOTE=EnderX;441671] Sorry, me no draw well. Me no have piggy to show. [URL="http://en.wikipedia.org/wiki/Spider-Ham"] [/URL][/QUOTE] and you no write english well either. | |
Re: It only counts the number of vowls in the last line read. Move the closing brace at line 27 down to line 39 so that the program will count the number of vowles in every line. Also in line 34 is it not necessary to use [b]isalpha[/b] because checking for … | |
Re: look at line 43 -- the condition is wrong because i is initialized to 0, so it will never be greater than 146. And why do you want that loop to print the same value for [b]numbers[/b] so many times? [b]numbers[/b] never changes value within that loop. [edit]line 34 is … | |
Re: use your compiler's debugger and step through the code. At the line where you get the assert error check variable values. | |
Re: That appears to be only part of your program because [b]main()[/b] looks incomplete. >>That's true, it wont work. It will work if you use the correct flags. Add [b]std::ate[/b] as the second argument to the open function. Read [URL="http://www.cplusplus.com/reference/iostream/ofstream/open.html"]this[/URL] for more information >>Only one time write values No idea because … | |
Re: >>so considering the fact, that each line in the inFile contains all leters of the alphabeth, at some point or the other....i'd have to use a lot of if-else statements? For example... if (x>y)...all the way down? Naw -- it is not that hard. What jamthwee posted was just an … | |
Re: you can write your own functions to replace them. ini configuration files are nothing more than simple text files that are in the format [code] [tag name] <field> = <value> [/code] So the program you write just searches for the tag name then the field and value. | |
Re: what compiler and what os? Never heard of a horizontal chart. Looks something like this: [code] 4 | 3 | 2 | 1 | 0 __________________________________ 1 2 3 4 5 6 7 [/code] You could use something called [URL="http://www.math.sunysb.edu/~scott/Book331/Plotting_with_Maple.html"]Maple[/URL] | |
Re: And after writing the output to a file call system() (or some other similar os-specific function) to launch Notepad, for example [code] system("Notepad myfile.txt"); [/code] | |
Re: >> i don't know is it correct Compile and test it and find out if its correct or not. 1. There is no need for the second and third parameters to that function and possibly not even the first parameter. You can make all those parameters local to that function … | |
Re: First, you need to make variable [b]pass[/b] one byte larger so that is can contain the normall c string null terminator. Then lines 7-13 can be simplified like this [code] char pass[] = "pasqwe"; [/code] Notice you don't have to specify the size of the array when initializing it with … | |
Re: >>different acount types like checking, savings, loans, mortgages, certificates, etc ? >>how to connect the different account types to the user You have that backwards -- connect users to account types. Each user has one or more account types, for example I have a checking account and a savings account. … | |
Re: Yes, but its more complex than you can handle right now. Just concentrate on writing the output to a simple text file. | |
Re: If this is for a school assignment then you probably should not use the boost library without your instructor's prior permission because he (or she) may not be able to compile it on school computers. | |
Re: Does the id array sort properly ? If not then you need to rethink the algorithm. Get that array sorted correctly first then you can add the code to swap the other array at the same time the id array elements are swapped. If you need a selection sort algorithm … | |
Re: you are using integers, so the program drops all fractions. [b]percentFigure / 100 [/b] is 0 for all values of percentFigure less than 100. Change data types to float and it will work as you expected. | |
Re: [QUOTE=cscgal;439440]Maybe he just is a bad lawyer? It's been my experience that people get jobs outside of their degrees either because they fell in love with an industry too late (i.e. after school) or because they aren't good enough to make it in what they have a degree in. [/QUOTE] … | |
Re: >>Then.. How would I do a sort in a parallel array? You are headed in the right direction, just need to learn how to access each element of the array. Array elements are numberd from 0 to the size of the array, in your program the array [b]score[/b] has three … | |
Re: you will have to allocate the array using the new operator, something like this: [code] int* scores = 0; // an unallocated array int nItems = 0; // number of items user will enter to set size of array cout << "enter array size"; cin >> nItems; // now allocate … | |
Re: If you have the source code then why can't you edit it? Should be simple plain-old text files just like the soruce for any other program. |
The End.