2,384 Posted Topics
Re: First, end the structure definition with a semicolon:[code]struct CpuInfo { char vendor_id[50]; int family; char model[50]; float freq; char cache[20]; }[B][COLOR=Blue];[/COLOR][/B][/code][Dani - here's where I wish I had the ability to make the size bigger.] Here you need to carefully watch how you use parentheses:[code]if( [COLOR=Red]([/COLOR] cpuInfo = fopen("/proc/cpuinfo", "rb") … | |
Re: Start at the beginning. Go from a blank source file to one with header(s) and a main function. Add some of the requirements that were heavily hinted. Post what you have and issues you are having. | |
Re: Maybe [thread=286]this[/thread] or one of the other links shown at the bottom under "Similar Threads". | |
Re: [url]http://www.eskimo.com/~scs/C-faq/q15.12.html[/url] | |
Re: [url]http://en.wikipedia.org/wiki/Goto_%28command%29[/url] | |
Re: [url]http://www.eskimo.com/~scs/C-faq/q13.16.html[/url] | |
Re: [QUOTE=btech]my question, which may be obvious is what is n? [/QUOTE]Whatever value you want to solve to. If you want the sum of squares from 1 to 5, it would be 5; if you want the sum of squares from 1 to 10, it would be 10. [QUOTE=btech]and what does … | |
Re: [code]#include <stdio.h> int main() { int A = 5; double B = 10.5; double result = A / B; printf("result = [COLOR=Blue]%f[/COLOR]\n", result); return 0; }[/code] | |
Re: [QUOTE=cscgal]What is an armstrong number?[/QUOTE][url="http://www.google.com/search?q=What+is+an+armstrong+number%3F"]What is an Armstrong number?[/url] [list] [*][url="http://homepages.cwi.nl/%7Edik/english/mathematics/armstrong.html"]http://homepages.cwi.nl/~dik/english/mathematics/armstrong.html[/url] [/list] | |
Re: [QUOTE=compshooter][FONT=Comic Sans MS]I want to start by saying I did use the search function and I did read the fstream tutorial. But I didn't see the answer I need.[/FONT] :confused:[/QUOTE]Show us the code from your initial attempt and describe the shortcomings. | |
Re: >1. typedef int (*MYPROC)(LPTSTR); This declares an alias MYPROC which is a pointer to a function taking an LPTSTR as a parameter and returning an int. >2. hinstLib = LoadLibrary(TEXT("myputs")); This is a call to the function LoadLibrary, which is passed the parameter of TEXT("myputs") -- TEXT is likely a … | |
Re: That was a pretty close attempt. [code]#include <iostream> #include <fstream> #include <string> using namespace std; int main() { [B]string[/B] arr[5]; int num; string first, last; fstream inData("file.txt"); [B]while ( inData >> num >> first >> last )[/B] { arr[num]= first+last; } for ( size_t i = 0; i < sizeof … | |
Re: [url]http://www.eskimo.com/~scs/C-faq/q10.11.html[/url] | |
Re: [url]http://www.parashift.com/c++-faq-lite/classes-and-objects.html#faq-7.8[/url] | |
Re: [url]http://parashift.com/c++-faq-lite/operator-overloading.html#faq-13.14[/url] | |
Re: [QUOTE=sunnypalsingh]You need to allocate one more space for null character..... and after for loop add this line [code] encryption[45]='\0''; [/code][/QUOTE]That will be out of bounds.[QUOTE=Acidburn]any other ideas?[/QUOTE]If you intend to use standard C-style string functions, they do require null termination. Otherwise, you could use looping or a function such as … | |
Re: [url]http://www.eternallyconfuzzled.com/tuts/bst1.html[/url] [url]http://www.eternallyconfuzzled.com/tuts/bst2.html[/url] [url]http://www.eternallyconfuzzled.com/tuts/bst3.html[/url] | |
Re: [Oooooh, when will these questions cease to poison new programmers...?] Yes. Hone your Googling skills if you are out of hints. [Bonus: Google the groups. Don't make me mention comp.lang.c (ooops!).] | |
Re: [QUOTE=Judas]Is it possible to use a variable for a vector name [/QUOTE]To me it sounds like you may want a [B]std::map[/B]. | |
Re: Scroll down to the bottom of this page and check out the Similar Threads. [URL=http://img118.imageshack.us/my.php?image=similar3db.gif][IMG]http://img118.imageshack.us/img118/59/similar3db.th.gif[/IMG][/URL] | |
| |
Re: [QUOTE=Acidburn]Not a problem as such but am i asking too much.... I can do a dynamic array for a 'int' but not for a multi dimensional array, can anyone help us out here?[/QUOTE]What is your intent -- what issue are you trying to solve? | |
Re: [QUOTE=sunnypalsingh]This works fine..where is 10 going??..how the compiler handles this??[/QUOTE]The same as it would any other useless code, such as:[code]int y, x = 10; x = 5;[/code]In the case of calling a function with a parameter, the value is still passed -- just like it would be if the value … | |
Re: [QUOTE=nikto]No suggestion is too obvious.[/QUOTE]Try making a "debug" version of the project and start stripping away code until the bug goes away. Then put back in the latest removal that displays the bug, if you don't figure out what it is, and then post that code with any relevant "minimal" … | |
Re: [url=http://groups.google.com/group/comp.lang.c++/msg/f0985ee0d82129bb]I don't believe so[/url]. | |
Re: One way (certainly not a great one): [code]#include <iostream> #include <cstdlib> #include <cstring> #include <ctime> using namespace std; int main() { cout << "this program will chose a name from a list randomly" << endl; char name[][5] = { "John", "Andy", "Matt", "Jane" }; srand(time(0)); char pick [ sizeof *name … | |
Re: [QUOTE=ramcfloyn]any ideas?[/QUOTE]I'm not really sure, but it sort of sounds like you want to do something along this line... [code]#include <iostream> #include <bitset> #include <vector> #include <algorithm> int main() { static const char init[] = "abcdefghijklmnop..."; std::vector<std::bitset<8> > str(init, init + sizeof init); std::copy(str.begin(), str.end(), std::ostream_iterator<std::bitset<8> > (std::cout, "\n")); return … | |
Re: What's your question? [edit] "An enumeration comprises a set of named integer constant values. Each distinct enumeration constitutes a different enumerated type." [url=http://dev.unicals.com/c89-draft.html#3.5.6]typedef[/url] | |
Re: It sounds to me like that you want to do is like most implementations: provide header files and object files -- except that you may have put your source code in the header rather than in its own module. I'd recommend putting declarations in the header, putting the definitions in … | |
Re: Please read the [url=http://www.daniweb.com/techtalkforums/announcement8-2.html]Announcement[/url]. | |
Re: My first reaction would be to say that [FONT=Courier New]sizeof[/FONT] is part of the language and go down that path... But one technique that might be used is to declare an array of a least two of the objects, declare two pointers to [FONT=Courier New]char[/FONT]; then cast & assign the … | |
Re: Yes, you can simulate multiplication by non-powers-of-two with shifting and adding. For example, 11 = 8 + 2 + 1, you can build up from that. | |
Re: I, for one, generally do much better at answering questions if the code posted is complete, yet small and fully compileable, and demonstrates the problem. | |
Re: Post any code you have for your calculator program and your make file. | |
Re: [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt__tempnam.2c_._wtempnam.2c_.tmpnam.2c_._wtmpnam.asp[/url][quote]Parameters prefix The string that will be prepended to names returned by _tempnam. [COLOR=Blue]dir The path used in the file name [B]if there is no TMP environment variable[/B], or if TMP is not a valid directory.[/COLOR][/quote]There is a standard [FONT=Courier New]tmpnam[/FONT]. | |
Re: The function [FONT=Courier New]gets[/FONT] is not safe and should be [url=http://www.eskimo.com/~scs/C-faq/q12.23.html]avoided[/url]. As in, NEVER use it. | |
Re: [QUOTE=Enzo]i mean using sockets in C++[/QUOTE]You didn't run across [url=http://www.ecst.csuchico.edu/~beej/guide/net/]Beej[/url]? | |
Re: Add a forward reference for [FONT=Courier New]class Vector[/FONT]? | |
Re: I think [FONT=Courier New]strspn[/FONT] may be a better choice for your validator. First you ask for the size of the array, and that was fine. [COLOR=Blue]Then you want to allocate space to a pointer, adding one to make room for the terminating null.[/COLOR] [COLOR=Magenta]Then use the pointer much like an … | |
Re: [quote]I have already used #ifndef,#define, and #endif preprocessor commands to surround each header, but there are still many "LNK2005, already defined in *.obj" errors and "LNK2001, unresolved external symbol" errors.[/quote]Make sure your headers have only declarations and not definitions (except maybe if you are using templates). [url]http://www.eskimo.com/~scs/C-faq/q1.7.html[/url] [url]http://www.parashift.com/c++-faq-lite/templates.html#faq-35.8[/url] [url]http://www.parashift.com/c++-faq-lite/templates.html#faq-35.9[/url] | |
Re: [QUOTE=vegaseat]2. use a macro like ... [code]// macro to swap two arguments of any type #define SWAP(x, y) ((x) ^= (y) ^= (x) ^= (y)) [/code][/QUOTE]That won't work for [I]any[/I] type. [url]http://www.eskimo.com/~scs/C-faq/q10.3.html[/url] | |
Re: This may help: [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp[/url] | |
Re: [URL=http://img141.imageshack.us/my.php?image=contest18mf.jpg][IMG]http://img141.imageshack.us/img141/4877/contest18mf.th.jpg[/IMG][/URL] [URL=http://img222.imageshack.us/my.php?image=dsc017797hh.jpg][IMG]http://img222.imageshack.us/img222/2083/dsc017797hh.th.jpg[/IMG][/URL] | |
Re: [QUOTE=kokopo2]do any of u know how to extract a certain amount of bits from a parameter(instruction) and return the bits as a integer in a range . [/QUOTE][thread=17834]This thread[/thread] may be of interest. | |
Re: [QUOTE=shashankk]Can anyone pl. mail turbo c++ setup as attachment to << moderator edit: email snipped >>[/QUOTE][url=http://www.daniweb.com/techtalkforums/faq.php?faq=daniweb_faq#faq_rules]Forum Rules[/url][quote][B]Keep it on the site[/B] [COLOR=Blue]Please do not post asking for an answer to be sent to you via email.[/COLOR] Problems and their responses assist others who read them. Please refrain from responding to … | |
Re: [url=http://www.daniweb.com/techtalkforums/announcement8-2.html][B]Announcement[/B][/url][quote][COLOR=Blue]This forum is meant for discussing programming languages in addition to exchanging code and algorithms.[/COLOR] However, it has become a problem where too many students are posting homework problems expecting a quick solution without ever trying for themselves. Not only does this constitute cheating, but it is very discouraging, frustrating, … | |
Re: [url]http://www.parashift.com/c++-faq-lite/input-output.html#faq-15.4[/url] [url]http://www.parashift.com/c++-faq-lite/input-output.html#faq-15.5[/url] [url]http://www.eskimo.com/~scs/C-faq/q12.2.html[/url] [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1046476070&id=1043284351[/url] |
The End.