1,088 Posted Topics
Re: May I have also a cup of "coffee and a croissant" please? :) | |
Re: [quote=virus.exe;333302]Hi, this is not a HUGE problem but I was jw why at the end off all my codes I have to type, system("pause");. When I even do the Hello World! program thing the black screen just flashes. I was jw why no one elses codes have this. Its not … | |
Re: Take a look at this[URL="http://www.cprogramming.com/tutorial/c/lesson8.html"] link[/URL] | |
Re: [quote=IwalkAlone;332274] [code] #include<conio.h> [/code] [/quote] I don't see any reason for you to use this header file in your code. In fact try to avoid using it at all, since is compiler specific and will make your code not portable. | |
Re: [quote=iamthwee;333425]What OS are you using?[/quote] What OS use C:\? :) | |
Re: >while(!foef(infile)) /*here's my problem*/ [COLOR=Blue][/COLOR]Try [COLOR=Blue][I][B]!feof[/B][/I][/COLOR](infile) | |
Re: Oops! you posted the same question twice. | |
Re: The [I][B]Break[/B] [/I]statement is used to change the flow of control. Is it use inside a [B][I]while, for, do/while, [/I][/B]or[B][I] switch[/I][/B] structure. And it causes the program to exit that structure immediatly, executing the first statement after that structure. You can use [I][B]break[/B][/I] statement to escape early from a [I][B]loop[/B][/I] … | |
Re: [quote=spankyg;331204] int *aptr = &a[0];[/quote] When you asign a pointer to an array you don't use the & operator. int *aptr = a; [quote=spankyg;331204] cout << (*aptr + 1); }[/quote] cout << *( aptr + i ) will do it. Notice the "*" outside the parenthesis, and the i to … | |
I am going through the exercises of this old C programming book, that doesn't have the answer in the back. Which is good. However I am not understanding a particular question. It says: Write a program that estimates the value of the mathematical constant e by using the formula: e … | |
Re: [quote=WaltP;330279]which is sort...[/quote] I would have love for you to finished the sentence. :) | |
Re: [quote]fprintf("Student Name SSN DOB CURR GRAD Yr");[/quote] [COLOR=DarkSlateGray]Did you forget where you want the be printed?.[/COLOR] fprintf([COLOR=Blue]out,[/COLOR]"Student Name SSN DOB CURR GRAD Yr"); Also [quote]fprintf(out,"%-30s\n %03d-%02d-4d\n %15s\n %8s\n %8d\n", s->name,f,m,l,s->dob,s->curr,s->gradyr);[/quote] If you don't take away the \n after every format operator you will have this: John Jones 123-45-6789 04-19-1978 CIS … | |
Re: It has to do with the order of precedence. The && evaluates before the ||. It is always evaluating [QUOTE] third != fourth && iteration < 5 [/QUOTE] [COLOR=Black]before anything else. You have to use () around the operations.[/COLOR] | |
Re: [quote=hbk619;329584]twhich bit did i screw up? should there be an &mood in the ()? i used that tutorial before and same problem still..[/quote] if you are talking about the switch(mood) you don't need to write the & operator there. Did you take a look at the links that Joeprogrammer posted … | |
Re: The sooner you post what you have so far of your code, the sooner that you will get help. As good as people are over here, still they can't read minds. | |
Re: Let's say you pass the array int A[] = { 1, 2, 3, 4 }; and that the int n is iqual to the number of elements in the array, in this case 3 since starts at element 0. This sorting function is going to do the following: the for … | |
Re: [code]for( x = 2; x < 100; x++ )[/code] This for loop will start with the value 2 stored in x and check every time if is less that 100, so it will never reach 100 numbers but 99, since at the 100th time it will quit. After the block … | |
Re: I'm having trouble also coming with my own solution. It would be great if someone would post an example of: [QUOTE]all permutations of 2 coins[/QUOTE] I'll keep working on it. | |
Re: [B]@ stringgader. [/B]The code that [B]goutham_see [/B]posted for you, works very well. Why don't you compare his with yours and learn what is not working with yours?. In your last post I see that you make the declaration of variables ALL Global. I don't think that's what you want even … | |
Re: [code=C]/*factirial*/ #include<stdio.h> #include<conio.h> void main() { int n,s=1,i; /* n = unknown garbage, s = 1, i = unknown garbage */ clrscr(); printf("enter n "); for(i=1;i<n;i++) /* Initially loop as long as i is less than n. what was in n?. Garbage! anything can happens */ { scanf("%d",&n); /* user … | |
Re: Look [URL="http://www.cppreference.com/stdio/sprintf.html"]here[/URL] for an example of how you can implement what Ancient Dragon is suggesting. | |
Re: @[URL="http://www.daniweb.com/techtalkforums/member17893.html"]Narue[/URL] I'm a little lost with this statement in the first [B]for[/B] loop : [quote][code]++saved[str[i]];[/code][/quote] What exactly is this line doing?. First increment saved to what? Second saved[whatever is pointer[index] ?] Could you explaning it for me, please?. Also I have a question with this line: [quote][code]unsigned char saved[CHAR_MAX] = … | |
Re: I decided to be a beta tester of you code :) This is the output of the test. [quote]Enter the desired number of rounds 3 [COLOR=Blue] The random number is 41[/COLOR] Guess the value of the random number 2 You are Warm Guess the value of the random number 3 … | |
Re: [quote=~s.o.s~;316991]And btw atoi is not always bad, depends on the context which it is used. See [URL="http://www.daniweb.com/techtalkforums/post316856-3.html"]this[/URL] snippet.[/quote] I followed your link because now I'm intrigued about atoi, however is for C++ and I don't know anything about it. Do you have another link that shows why is bad to … ![]() | |
I'm at the point of learning how to write to a file. I created these lines as a test. My concern is that it doesn't look right that I have to write the same sentences for displaying it to screen and to put it in file. [code=c] /* * data.c … | |
I think one of the reasons authors of books about programming in C make heavily use of the function scanf() is that is readily available and easy to use for the new learner. That's all good and dandy, however when writers of this books get to the more advanced topics, … | |
I don't visit any other forum but the C and C++, so I don't know if there's a different place where I can make this comment. However, I'm going to go ahead and say. I would like to give a public and loud THANK YOU! to this people: [COLOR=Blue]Mr.WaltP Mr.Ravalon … | |
May I impose on you guys again? I'm trying to learn how to write to disk into a file. I think I got that down, however I would like to be able to display to screen the same text is being written to file. What's a way of doing that?. … | |
Re: @ [B]Dave Sinkula, [/B]That little bit of sample code is going to be very helpful to me, now that I'm using pointers. Thank you!. However I noticed that the array is a int; how do you do when is a array of chars. I'm struggling with strings. I don't know … | |
Re: You guys lost me at the "Hello". :) But since you seem to be very knowledgeable (I know you are) I have a question for you: In C programming there's a way I could see what is in the stdin buffer?. I always hear about stdin buffer, how big is … | |
Re: I have been researching for some days about this problem with the '\n' left behind. This have been posted: [quote] >>I would use a wrapper function or write my own version of fgets to suit my application. [/quote] Now I'm intrigued by it. Could anyone post a little example of … | |
Re: Would this help you?. Use the function to adapt it to your own program [code][COLOR=Blue] /* * reverse_digit.c * a sample program to reverse the digits of a given number */[/COLOR] [COLOR=Magenta]#include <stdio.h>[/COLOR] void reverse_it(int value); [COLOR=Blue] /* function prototype */[/COLOR] int main() { int number; printf("Enter a number: "); … | |
Friends, I have a question: Many times in books and tutorials I'm sent to consult the Standard C Library reference. Sometimes, references are made to some Standard C function. Where do I see the Standard C Library in a compiler. I don't see any source code in my compiler that … | |
Re: To be honest I don't know anything about C++, but I know this much [quote] x=x+0; //add 1 to x[/quote] This is not adding 1, you add 1in this way x++; or x = x + 1; or x += 1; [quote] y=y*2; //divide y by 2[/quote] and this is … | |
Re: @[URL="http://www.daniweb.com/techtalkforums/member85533.html"][IMG]http://www.daniweb.com/techtalkforums/customavatars/avatar85533_9.gif[/IMG][/URL] [URL="http://www.daniweb.com/techtalkforums/member85533.html"][COLOR=#003366][B]~s.o.s~[/B][/COLOR][/URL] I like how you explained functions. I'm just started learning and with your explanation and the previous code I made it work. Thank you for not just correcting the errors. Made me think. | |
I have been trying to figure out how to deal with any situation when the result is bigger than what a integer declared can hold. For example: [code] [COLOR=Blue]/* * Old_guy.c * */[/COLOR] [COLOR=Magenta] #include <stdio.h> [/COLOR] int main() { unsigned long int hartbits; [COLOR=Blue] /* years * days * … | |
Hello, everyone. I live in Utah, but I'm from Canary Islands. Googling for a C source code about opening and closing the cdrom tray, I came across this great forum. I never found what I was looking for, however, next day I browsed again since DaniWeb appealed to me. I … |
The End.