Thread: strings

  1. #1
    Registered User
    Join Date
    Apr 2002


    this is a program for splitting numbers from letters, the only problem i have is that it doesnt count any after it finds a lettre.

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

    int main()
    int size;
    printf("Enter a string of letters and numbers.\n");
    char string[50];
    scanf("%s", string);
    size = strlen(string);
    printf("\nYour string is %d byt%s long...\n", size, (size==1 ? "e" : "es"));
    printf(" ... and contains %d characters\n\n", size);
    printf("string = %d\n", atoi(string));
    return 0;

    ie, input: 51516fef54, and the output will be 51516 (leaves the 54). how do i make it find the 54 at the end?


  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Please see your other post for a detailed description of how to solve this problem.

    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Strings Program
    By limergal in forum C++ Programming
    Replies: 4
    Last Post: 12-02-2006, 03:24 PM
  2. Programming using strings
    By jlu0418 in forum C++ Programming
    Replies: 5
    Last Post: 11-26-2006, 08:07 PM
  3. Reading strings input by the user...
    By Cmuppet in forum C Programming
    Replies: 13
    Last Post: 07-21-2004, 06:37 AM
  4. damn strings
    By jmzl666 in forum C Programming
    Replies: 10
    Last Post: 06-24-2002, 02:09 AM
  5. menus and strings
    By garycastillo in forum C Programming
    Replies: 3
    Last Post: 04-29-2002, 11:23 AM