1,088 Posted Topics

Member Avatar for tjay
Member Avatar for virus.exe

[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 …

Member Avatar for WaltP
0
2K
Member Avatar for grunge man

Take a look at this[URL="http://www.cprogramming.com/tutorial/c/lesson8.html"] link[/URL]

Member Avatar for John A
0
153
Member Avatar for IwalkAlone

[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.

Member Avatar for John A
0
127
Member Avatar for Colin Mac

[quote=iamthwee;333425]What OS are you using?[/quote] What OS use C:\? :)

Member Avatar for Colin Mac
0
100
Member Avatar for tayster
Member Avatar for potato_bum

>while(!foef(infile)) /*here's my problem*/ [COLOR=Blue][/COLOR]Try [COLOR=Blue][I][B]!feof[/B][/I][/COLOR](infile)

Member Avatar for Aia
0
5K
Member Avatar for potato_bum
Member Avatar for notfornothing21

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] …

Member Avatar for John A
0
126
Member Avatar for spankyg

[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 …

Member Avatar for John A
0
125
Member Avatar for Aia

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 …

Member Avatar for ~s.o.s~
0
186
Member Avatar for jobellelaiza

[quote=WaltP;330279]which is sort...[/quote] I would have love for you to finished the sentence. :)

Member Avatar for ~s.o.s~
-1
158
Member Avatar for Bobbiegirl

[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 …

Member Avatar for Aia
0
167
Member Avatar for flageolet

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]

Member Avatar for WaltP
0
120
Member Avatar for hbk619

[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 …

Member Avatar for hbk619
0
206
Member Avatar for Amanda21

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.

Member Avatar for Aia
0
79
Member Avatar for mzd12111

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 …

Member Avatar for mzd12111
0
125
Member Avatar for livingsword

[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 …

Member Avatar for livingsword
0
413
Member Avatar for fulyaoner

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.

Member Avatar for fulyaoner
0
407
Member Avatar for stringgader

[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 …

Member Avatar for stringgader
0
296
Member Avatar for ajay kandari

[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 …

Member Avatar for Salem
0
402
Member Avatar for bigben09

Look [URL="http://www.cppreference.com/stdio/sprintf.html"]here[/URL] for an example of how you can implement what Ancient Dragon is suggesting.

Member Avatar for kansmish82
0
94
Member Avatar for varsha_saxena

@[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] = …

Member Avatar for varsha_saxena
0
114
Member Avatar for boujibabe

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 …

Member Avatar for boujibabe
0
279
Member Avatar for dalton

[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 …

Member Avatar for iamthwee
0
806
Member Avatar for Aia

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 …

Member Avatar for John A
0
222
Member Avatar for Aia

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, …

Member Avatar for Aia
0
276
Member Avatar for Aia

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 …

Member Avatar for ~s.o.s~
6
136
Member Avatar for Aia

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?. …

Member Avatar for Ravalon
0
175
Member Avatar for pointers

@ [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 …

Member Avatar for WaltP
0
200
Member Avatar for HS20064972

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 …

Member Avatar for ~s.o.s~
0
140
Member Avatar for hariza

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 …

Member Avatar for Dave Sinkula
0
152
Member Avatar for rajbasu

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: "); …

Member Avatar for Salem
0
125
Member Avatar for Aia

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 …

Member Avatar for Dave Sinkula
0
256
Member Avatar for EJCBmore03

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 …

Member Avatar for WaltP
0
178
Member Avatar for 80s

@[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.

Member Avatar for Aia
0
497
Member Avatar for Aia

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 * …

Member Avatar for Aia
0
190
Member Avatar for Aia

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 …

Member Avatar for happygeek
0
97

The End.