Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by chopstick

  1. chopstick

    some questions about this

    just like Salem said, it only recognise control-Z at the beginning of a line, why?
  2. chopstick

    some questions about this

    the code is like this: #include<stdio.h> int main(void) { float average; int flag=0; int c=0; int word=0; char ch; printf("pls enter your sentence:"); while ((ch=getchar())!=EOF) { if(ch!=' '&&ch!='\n') c++; if(ch!='...
  3. chopstick

    about the use of &quot;continue&quot;

    I have writen this code here: while (ch=getchar()!=EOF) { if(ch=='\n'||ch==' ') continue; else { counter1=0; while(counter1<=1000) { counter=0; while(counter<=1000000) {...
  4. chopstick

    about scanf?

    I tried to type in a letter "A" when I use the following code, scanf("%d",&choice);//I entered 'A' printf("%d",choice);//I get 32 here! and choice is integer which is 32 bits, can anyone tell me what happened when the letter is keyed in? if I entered 'A', scanf("%d",&choice); is evaluated as...
  5. chopstick

    syntax problem

    this is part of the code: while((ch=getchar())!='#') { if(ch=='.') { putchar('!'); count++; } if(ch=='!') { printf("!!"); count++; } else putchar(ch); } I thought the "else" is associated with the second "if", but...
  6. chopstick

    what happened to this output?

    #include<stdio.h> int main(void) { float c; printf(" pls key in your code:"); scanf("%f",&c); printf("the output is %f or %e",c,c); system("pause"); return 0; } after I have compiled the code above, I typed in 21.29, and what I get is "the output is 21.290001 or 2.129000e+001", why I got the...
  7. chopstick

    about int size?

    is the int size determined by the CPU or the compiler itself?
  8. chopstick

    what happened when I used %d in printf()

    what happened when I use %d in printf() to display a long int or unsigned number? consider the code below: #include<stdio.h> int main(void) { unsigned un=40000; printf("un=%u and not %d",un,un); return 0; } and what I get is "un=40000 and not -25536", what was going on here? thanks for help.

Part and Inventory Search

Back
Top