15,300 Posted Topics

Member Avatar for computer engW

Q1: do you know what 2! and 4! mean and how to calculate them with pencil & paper? If not then you need to study factorials, which are used in statistics. Q3: do it just like you would numbers. Lets say you have three characters 'C', 'A' and 'Z'. Which …

Member Avatar for computer engW
0
81
Member Avatar for Dani

I found them annoying at first, but I've gotten use to them. The last post in the thread would be more useful, but too time consuming to implement.

Member Avatar for ~s.o.s~
0
98
Member Avatar for TheFueley

>>I don't quite know "what to return" from this block of code It means that function must return something. You need to add [icode]return input;[/icode] on line 29 or the first code you posted.

Member Avatar for TheFueley
0
182
Member Avatar for demroth

how big is [b]number[/b] ? Is [b]array_size[/b] the number of valid elements in the array? If that is true then line 9 is wrong because there is no such element as number[array_size] -- should be number[array_size-1] why is that reading the file one character at a time? The >> will …

Member Avatar for demroth
0
144
Member Avatar for picass0

jamthwee is right -- in order to change something in a text file you have to rewrite the entire file, making whatever changes you want while writing the file. Calling seekg() does nothing to help you with that. If the current password is "abc" and the new password is "abcdefg" …

Member Avatar for Ancient Dragon
0
152
Member Avatar for scream2ice

If those are two different problems then please start a new thread for each problem. Tossing them all together into the same thread makes it almost impossible for others to answer without a lot of confusion

Member Avatar for Ancient Dragon
0
128
Member Avatar for dgg32

char* is a pointer which can be made to point to most anything, while I guess you mean std::string c++ class.

Member Avatar for Ancient Dragon
0
94
Member Avatar for Oba

[QUOTE=techno t;555437]Unfortunately the more difficult ones I struggle to read, lol so it's a balance really *[/QUOTE] I agree, Sometimes I get frustrated at not being able to successfully type the right characters and just leave with web site. Result: they just lost a member.

Member Avatar for >shadow<
0
379
Member Avatar for superjacent

try this slightly modified version of your program. In both cases you can only enter 19 characters, not 20, because the 20th byte is reserved for the string's null teriminator -- 0. [code=cplusplus] int main() { char getdata; cout << "Enter one character: "; cin >> getdata; cin.get(); char line[20] …

Member Avatar for superjacent
0
309
Member Avatar for Afi83

>>But know how I can access to my values in array Is that the question -- how to extract each of the numbers in the string ? extract them using sscanf(). There is a simple example [code] int main() { char line[] = "123 234.56 789"; int a, b; float …

Member Avatar for Afi83
0
437
Member Avatar for CassieJ
Member Avatar for Fungus1487
0
150
Member Avatar for knewc

knewc: line 20: you can't reverse the string using the same charcter array as the original string. You need to use a second array. That's the purpose of [b]new_string[/b]. And use the = operator, not +=. >>i could do this with my hands tied behind my back and plunk it …

Member Avatar for Ancient Dragon
0
140
Member Avatar for LightSystem

[URL="http://www.cs.cf.ac.uk/Dave/C/node27.html"]Here [/URL]are some examples

Member Avatar for LightSystem
0
134
Member Avatar for sickly_man

Return values are normally passed back in registers -- its standard practice to put a 16-bit int (short in C) in AX, 32-bit in EAX or DX::AX and 64-bit on EDX::EAX. But you can do it anyway you want. pointers to arrays etc are done the same way. If those …

Member Avatar for sickly_man
0
138
Member Avatar for dgg32

You probably need to read a [URL="http://home.netcom.com/~tjensen/ptr/pointers.htm"]pointer tutorial[/URL] to find out what pointers are and how to use them.

Member Avatar for Aia
0
373
Member Avatar for David Wang

If you have a choice of GUI then I would probably start with [URL="http://www.opengl.org/documentation/"]OpenGL[/URL] because its free, portable and has a lot of support for questions etc.

Member Avatar for David Wang
0
132
Member Avatar for pete212

[URL="http://www.cprogramming.com/tutorial/lesson14.html"]tutorial here[/URL]

Member Avatar for Narue
0
218
Member Avatar for dinozulf
Re: C++

certainly we can help, afterall that's what DaniWeb is all about :) Post the requirements and what you have done to solve it, along with compiler error messages and/or your questions.

Member Avatar for Sky Diploma
0
79
Member Avatar for Nicholas_G5
Member Avatar for vijayan121
0
133
Member Avatar for taotesea

I don't really know anything about that raw_open() function, but from [URL="http://msdn2.microsoft.com/en-us/library/ms527302(EXCHG.10).aspx"]this vb example[/URL] the parameters are supposed to be of type _variant_t, not BSTR.

Member Avatar for fyz
0
191
Member Avatar for w0090463

1) limits.h has CHAR_BIT that defines the number of bits in a byte for your machine. Just find the file size and multiply by CHAR_BIT. 2) This wants two answers -- convert KB to bytes by multiplying by 1024, then divide that answer by the number bytes per second to …

Member Avatar for ajay_kumar47
0
174
Member Avatar for Jeniefer
Member Avatar for mrgreen108

Use windows explorer to check the location of the input file -- it probably isn't in the folder you think it is. If no path is given the file must be in the same folder as the executable program. And the output file will also be written to the same …

Member Avatar for mrgreen108
0
293
Member Avatar for marti3a3

line 31: that is calling GetRadius() ok but throwing away its return value. [icode]flat radius = Sweet.GetRadius();[/icode] Other similar lines have the same problem. line 45: endl only works with cout. lines 54 and 68: those functions must return some value even if it fails the validation. return 0 would …

Member Avatar for Ancient Dragon
0
95
Member Avatar for Mark515

1) [icode]Sleep(60*1000);[/icode] -- MS-Windows, *nix is the same except use sleep(60) instead of Sleep() 2) best to write the last time to some external file, such as the registry or a file, so that your program can continue to do other things during that lengthly time. Then once each hour …

Member Avatar for Ancient Dragon
0
107
Member Avatar for Seamus McCarthy

line 8: should be [icode]const int capacity[/icode] line 9: you need to initialize all the bytes of the array with 0 so that they contain a known value [icode]char letter[capacity] = {0};[/icode] line 17: >>char letter[] = {A}; That is incorrect -- shold probably be [icode]letter[pax] = 'A';[/icode] What it …

Member Avatar for Seamus McCarthy
0
105
Member Avatar for lAmoebal

[code] char type[sizeof(int)]; memcpy(type, (char *)&numtype, sizeof(int)); [/code]

Member Avatar for Ancient Dragon
0
142
Member Avatar for Mark515

you are doing integer math and you need to do floating point math [code] int a = 2; int b = 3; int c = 2; float result = (float)(a+b+c)/3.0F [/code]

Member Avatar for Ancient Dragon
0
73
Member Avatar for jesseb07

Encryption only keeps the casual observers out -- professional hackers will break the encryption algorithm pretty easily. There has never ever been an encryption algorithm that has not been broken by someone, even the algorithms used by military can be broken given enough time and effort and is why they …

Member Avatar for jesseb07
0
106
Member Avatar for Black Magic

[code] int main() { cout << (int)'£' << "\n"; return 0; } [/code] The output of the above on my computer is -93. You'll have to change the local setting if you want to print that character from -93 because it doesn't print that with the standard american local setting.

Member Avatar for Ancient Dragon
0
107
Member Avatar for redclay34

>>Does anyone know if there is someway to write something harmless to \\.\PhysicalDrive0 Nope. There is nothing [b]harmless[/b] about writing anything to a drive. It is always a destrictive write (meaning it destroys whatever was written there before).

Member Avatar for Salem
0
88
Member Avatar for komany

by [b]vector[/b] do you mean a character array ? Such as [icode]char data[255];[/icode] Use the FILE and associated functions located in stdio.h to read and write files. [URL="http://www.cprogramming.com/tutorial/cfileio.html"]Here[/URL] is a tutorial.

Member Avatar for komany
0
332
Member Avatar for ok555

If you are passing smath to a function then you will also have to pass the number of elelemts, because there is no way for the function to get the number of elements from just a pointer. sizeof(any pointer here) in 32-bit compilers is always 4. sizeof(struct math) is 8. …

Member Avatar for ok555
0
183
Member Avatar for bojanski

>>which is the best way to sort the numbers at the end - use <algorithm> with sort, or do some loop to sort them? Depends on whether you need to write your own sort algorithm or not. If you instructor doesn't care then I'd use std::sort because its much simpler. …

Member Avatar for bojanski
0
128
Member Avatar for Yellowdog428

why is Student.Major and integer ? why not a string to that you can enter CS (computer science) or any other major ? VC++ 2008 Express runs without errors too. But that doesn't mean there are no errors in the program. Actually there are several errors -- buffer overruns. For …

Member Avatar for Yellowdog428
0
110
Member Avatar for ankit_the_hawk

you have to allocate space to temp before doing that. You need length of chars1 + length of chars2 + 1 number of bytes [icode]temp = new char[strlen(chars1) + strlen(chars2) + 1];[/icode]

Member Avatar for Ancient Dragon
0
103
Member Avatar for The Dude
Member Avatar for The Dude
2
108
Member Avatar for nilesh03

sort the lines just like you would sort any other set of strings, but instead of comparing the strings first find the first tab in the line and compare the strings up to that position [code] #include <iostream> #include <string> #include <algorithm> #include <vector> using namespace std; struct SAscendingDateSort { …

Member Avatar for Ancient Dragon
0
109
Member Avatar for Acquire

any particular reason to use a hash? A simple linked list of structures would do the job. When done reading just sort the list by frequency and you're done.

Member Avatar for Ancient Dragon
0
135
Member Avatar for jimJohnson
Member Avatar for M1A1

My guess is that you do not have the list of directories set up correctly in the compiler IDE. Look at menu Tools --> Options --> Project and Solutions --> C++ Directories and make sure the path to the include directories are correct and includes the path to where you …

Member Avatar for Darkkal
0
256
Member Avatar for Nimz

Did you try to compile it? Or are you allowed to do that? Read the line one at a time, pay close attention to spelling and variable initialization. I can spot three mistakes right away.

Member Avatar for joshmo
0
104
Member Avatar for flash121

You have at least two choices: 1) Use ClassWizard to give the edit control a variable name. Menu View --> Class Wizzard, elect the control id then [b]Add Variable[/b]. For an edit control that will create a CString object which will be filled when UpdateData(TRUE) is called. 2) Get the …

Member Avatar for mitrmkar
0
2K
Member Avatar for Gondt

[URL="http://publib.boulder.ibm.com/infocenter/macxhelp/v6v81/index.jsp?topic=/com.ibm.vacpp6m.doc/language/ref/clrc07cplr237.htm"]Here [/URL]is an explaination of default parameter values. That link talks about exactly what you are trying to do.

Member Avatar for Gondt
0
276
Member Avatar for georgioue

>>PLEASE HELP ME!!!!! help you do what? does your program compile ? (hint: no it does not). what errors does your compiler produce? [code] if(txt.find(a)!=txt.end()) { cout<< } [/code] Above is incomplete statement.

Member Avatar for Ancient Dragon
0
143
Member Avatar for savinki

you can try something like this: But your tempValue buffer may not be large enough, depending on the length of the string. Should be at least string length * 7, maybe larger. [code] char temp[16]; tempValue[0] = 0; // put below in a loop for each character sprintf(temp,"0x%04X, ", Buffer[i]); …

Member Avatar for Ancient Dragon
0
134
Member Avatar for saswatdash83

its totally up to the compiler whether it honors the inline keyword or not, and there is no way to force the compiler to do it one way or the other, except maybe make the inline code a macro.

Member Avatar for Ancient Dragon
0
108
Member Avatar for avi1109

you could resort to C's stricmp(), or for some compilers, comparenocase() to make case-insensive comparisons [icode]if( stricmp(element.c_str(),Institute[m].c_str()) == 0) [/icode] There is also c++ std::transform() that you could use to convert the strings to either all upper or lower case before comparison, but its a lot more ugly to read …

Member Avatar for Ancient Dragon
0
138
Member Avatar for superC
Member Avatar for super star 90

It isn't necessary for you to manually put all those line numbers in your code -- the code tags will do that for you. [quote=Salem] This tells you to use code tags - [url]http://www.daniweb.com/forums/forum2.html[/url] So does this - [url]http://www.daniweb.com/forums/forum8.html[/url] Wait for it, wait for it - [url]http://www.daniweb.com/forums/announcement8-3.html[/url] You're not going …

Member Avatar for Ancient Dragon
0
72

The End.