- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 7
- Posts with Upvotes
- 6
- Upvoting Members
- 5
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
20 Posted Topics
Re: Are you programming in C (file extension .c) or in C++ (file extension .cpp)? | |
Re: [QUOTE=pjh-10;1770135][CODE]#include <iostream> #include <cstdlib> #include <ctime> #include <cmath> using namespace std; int main() { int song[1000]; int n; srand(time(0)); for (int i=0; i<1000; i++) { song[i] = i; } while (cin >> n) { for (int i=0; i<(1000-1); i++) { int r = i + (rand() % (1000-i)); int temp … | |
Re: The minimum range for int is -32767 to +32767. If your compiler (also known as implementation) is at this minimum, int is not large enough to store 6 digits. However, many implementations have a much larger range so that may not be your problem. You may want to look values … | |
Re: Multiposts [Here](http://www.dreamincode.net/forums/topic/271931-output-prime-and-perfect-numbers-between-1-and-1000/) | |
Re: [QUOTE=meme meme;1780752]how can i check if the number is positive or not by using switch statement[/QUOTE] [QUOTE=WaltP;1780786]Use the % operator in the SWITCH statement. You know what values you will get so use those values in the CASE statements.[/QUOTE] Walt, note that I am not the OP. I am getting … | |
Re: [QUOTE=megaman656;1772733]for example, i want to combine two number 6 and 8 and it will equal 68. is this possible in C? [ICODE]int a = 6, b = 8,c; c=ab; [/ICODE] and c will = 68.[/QUOTE] Yes it is possible, but not the way you have shown. Your assignment statement assigns … | |
Re: [QUOTE=arold10;1769607]I want to write this function integerPower(base, exponent) that return the value of base^[I]exponent[/I] For instance integerPower(3, 4) = 3*3*3*3 The function has two parameters my question is how can I use the for loop to control the calculation? It's not that hard to use the for loop when the … | |
Re: [QUOTE=gerard4143;1493498]The only reason to put header files in makefile is to check to see if they exist. [/QUOTE] No, the reason to include header files in a make file is so that if the header file is updated, but the source file that includes it has not been updated, that … | |
Re: [QUOTE][CODE]printf("%d %d %d\n",a=10,a=20,a=30); [/CODE][/QUOTE] The language standard indicates this statement has "undefined behavior" because the variable a is changed more than once between two squence points (start of the statement and before the function call but after all the parameters have been evaluated). In this case, there are three assignment … | |
Re: [QUOTE=Ancient Dragon;1311829]Borland does have modern 32-bit/64-bit compilers, they are not free. The only free Borland compilers are ancient and obsolete. I can't vouch for how good or bad the newest Borland compilers are because I don't use them. But since Borland is still in business I suppose enough people/companies are … | |
Re: [QUOTE=prvnkmr449;1325287]... Both are correct and have no problem at all. ...[/QUOTE] For a hosted environment, only the second version is explicitly given in the C99 standard. The first is only valid if it is covered under the "or in some other implementation-defined manner." clause. | |
Re: [QUOTE=cezar.elnazli;1307386]I'm trying to validate a day of the month, so that if the user enters a negative value or a value above 31, the program prints an error message and prompts for another day. The code below doesn't work as expected. Instead, it gets caught inside an infinite loop, printing … | |
Re: [QUOTE=gahhon;1302403]this is what i had tried assign the value of monthly sales into a variable, after that only switch statement. [CODE]#include <stdio.h> void main() { int monthly_sales, a; double monthly_income; printf("Enter your monthly sales amount > "); scanf("%d", &monthly_sales); if(monthly_sales >= 50000) a = monthly_sales; switch(monthly_sales) { case 'a': { … | |
Re: [QUOTE=daredevil786;1301628]i know that but i want to know the reason behind it why its happening[/QUOTE] It is happening because in [I]The C Programming Language [/I]by Brian W. Kernighan & Dennis M. Ritchie (Prentice Hall 1978) on page 147 (based on 15th printing) where it is finishing its description of the … | |
Re: [QUOTE=gerard4143;1305129]Try something like [code] #include <stdio.h> typedef void (*myfunction)(void); void TSL1_ReadMemory32() { fputs("called!\n", stdout); } struct { myfunction thefunct; const char* functionName; }lookUpTable[] = { {TSL1_ReadMemory32, "ReadMemory32"}, {NULL, NULL} }; int main() { lookUpTable[0].thefunct(); return 0; } [/code][/QUOTE] gerard4143: Why are you suggesting a typedef for the function? I am … | |
Re: [QUOTE=Ancient Dragon;1300024]You said it was 16-bit console. Unix has never been a 16-bit operating systm. ...[/QUOTE] My rememberence was that *nix started on the DEC PDP-11 which was a 16-bit computer. After checking with wikipedia, the current version of the article indicates that the team started on the DEC PDP-7. … | |
Re: On just a quick review, does this version even compile without error? Lines 115 and 116 use variables which are not defined locally: parent and location. If the condition in line 105 is true on the first pass through the loop, p will not be initialized when used in lines … | |
Re: [QUOTE=vinotharose;1302970]please allow me to access the telephone directory.[/QUOTE] vinotharose: Please read the [URL="http://www.daniweb.com/forums/thread78060.html"]"Read This Before Posting"[/URL] thread especially the section entitled "Don't resurrect old threads!". My answer to your question for the United States is to direct you to the [URL="http://www.att.com/gen/general?pid=10908"]Directory Resources[/URL] page of AT&T. Other United States telephone companies … | |
Re: [QUOTE=daredevil786;1301509]first of all thanks for all this and i want to know is it legal to have one side pointer arithmetic and on one side a int variable and i was saying it to be 8 because ptr is pointing to a integer variable so there should be a difference … |
The End.