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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. bigtamscot

    Help with compilation problem

    ...try this.. #include <time.h> #include <stdio.h> int main (void) { struct tm today; time_t time_in_secs; time_in_secs = time(NULL); /* for todays date */ today =*localtime(&time_in_secs); printf(&quot;Date %02d/02d/02d\n&quot;,today.tm_mday,today.tm_mon+1...
  2. bigtamscot

    silly question

    Also the function works for any value from -42 million to +42 million. Hoping to get certified..in C programming.
  3. bigtamscot

    silly question

    ...tun = 100L; long under100 = 0L, under1000 = 0L, undermill = 0L, convertval = 0L, overmill = 0L; char minus = ' '; if(bal_val < 0) /* negative value ?*/ { /* converts to positive */ bal_val -= (bal_val * 2); minus = '-'; /*minus sign for display or print */ }...
  4. bigtamscot

    wite a program in 'c'to add very la

    go on then do it, or do you expect us to do it for you???? Hoping to get certified..in C programming.
  5. bigtamscot

    Hi, I'm new to C. Can anyone sho

    Alternatively, you could go... void check (int number) { for( ; ;number++ ) if(number % 10 == 0) return; /* don't need a value here */ } Hoping to get certified..in C programming.
  6. bigtamscot

    cursor positioning command

    you could use gotoxy(x, y) function in C, but only if your compiler supports the #include file <conio.h> #include <conio.h> #include <stdio.h> int main (void) { printf(&quot;The first line\n\n&quot;); printf(&quot;note the cursor position now\n&quot;); printf(&quot;Hit any key and...
  7. bigtamscot

    Hi, I'm new to C. Can anyone sho

    ...by reference compared to by value....not the use of the ampersand ( & ) in the call to refer_check function and the use of the pointer symbol ( * ) in the function and in the prototype and definition. #include <stdio.h> #include <string.h> void refer_check(char *array, int *num); void...
  8. bigtamscot

    Hi, How do you initialize a stri

    string [100] = &quot;\0&quot;; this is correct!! Hoping to get certified..in C programming.
  9. bigtamscot

    fread problem

    OR use while((fread(&partrecord, sizeof(part), 1, inp))!=1){ printf(&quot;%s %-20s %.2f %-d %-d %d %d/%d/%d\n&quot;, partrecord.part_id, partrecord.part_descr, partrecord.unit_price, partrecord.quan_onhand, partrecord.reodr_pt,partrecord.reodr_qty...
  10. bigtamscot

    Converting string to numeric

    reading your question again, do you just require to check if the character stored in a member are numeric. If so then look at the functions isdigit(), isalpha() in lib <stdlib.h> if(isdigit(str.ch)) printf(&quot;character %c numeric&quot;, str.ch); else printf(&quot;character %c...
  11. bigtamscot

    Sorting an array of strings!!

    see my answer to post &quot;alternatives&quot;, espeically point on concatenation where destination string needs to be big enough to hold both strings. Hoping to get certified..in C programming.
  12. bigtamscot

    getchar () vs scanf

    try fflush(stdin);........you dont say what the prompts ask for int or char value. there are a number of different ways to read charcters, some of which are compiler and os dependant. have a look at fgetc(stdin); Hoping to get certified..in C programming.
  13. bigtamscot

    Probably a stupid scanf/getchar question

    With this part of the code code=scanf(&quot;%c&quot;,code); the compiler first of all scans (reads) the choice into code, which in this case is wrong syntax anyway - you forgot the ampersand &, then you reassign code a different value by having code equal to the return value of scanf, which...
  14. bigtamscot

    Leading Zeros

    int i = 32; printf(&quot;%04d&quot;, i); this will print - 0032 Hoping to get certified..in C programming.
  15. bigtamscot

    Format of ITOA

    itoa(num, string, 10); where the last parameter is always &quot;10&quot; if you are using the base-10 (normal) number system. Hoping to get certified..in C programming.
  16. bigtamscot

    Reading /Writing structure

    ...are declaring variables in different lines in your code other than at the start. This is C not C++. In C you have to declare your XYZ xyz; and FILE *fp1; at the start before process begins. this was found without looking for other faults if there are any. Hoping to get certified..in C...
  17. bigtamscot

    Changing Character Array Content

    ...write character to third string using and incrementing the counter. After final iteration of outer loop add null character to third string. for(*sptr1 = string1; *sptr1, sptr1++) { for(*sptr2 = string2; *sptr2, sptr2++) { if(*sptr1 == *sptr2) { flag = 1...
  18. bigtamscot

    In C how to extract the integer and decimal part from a float number

    ...grand = 1000L, tun = 100L; long under100 = 0L, under1000 = 0L, undermill = 0L, convertval = 0L, overmill = 0L; bal_val *= 100; // convertval = (long)bal_val; if(convertval > test1) { under100 = convertval % tun; under1000 = convertval % test2; under1000 =...
  19. bigtamscot

    How to make scanf() read first word of a line then jump to next line

    ...then loop through each line of text and increment the counter like so int counter = 0; char str[line_length]; // string of required length FILE *fp; fp = fopen(filename, &quot;rt&quot;); while(fscanf(fp,&quot;%[^\n]\n&quot;, str)!=EOF) counter++; printf(&quot;File holds %d lines of...
  20. bigtamscot

    How to distinguish between characters and numers.

    CORRECTIONS TO MY CODE ABOVE #include <stdio.h> #include <ctype.h> void main () { char string[11], result[11], *ptr; int count = 0; printf(&quot;Enter a string up to 10 charcters :&quot;); gets(string); ptr = string; while(*ptr) { if(!isdigit(*ptr)) { if(*ptr != '-') break...

Part and Inventory Search

Back
Top