I need a lot of help

This is a discussion on I need a lot of help within the C++ Programming forums, part of the General Programming Boards category; I'm trying to do a project but really cant get started, i'm very new to C and any help would ...

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    7

    Unhappy I need a lot of help

    I'm trying to do a project but really cant get started, i'm very new to C and any help would be appreciated.

    I need to input some characters through my keyboard eg abdg654bdfs234. And place any numbers in a set (ie 654, 234).and ignore the letters

    I have no idea how to do it

    I know if i can get this sorted my project will flow but im really stuck

  2. #2
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    Code:
    // Code to take out letters in a variable
    ..
    int temp[10];
    int number[10];
    int y = 0;
    
    cin >> temp;
    
    for(int x = 0; x<=10; x++)
    {
         if(temp[x] >= 0 || temp[x] <= 9)
         {
              number[y] = temp[x];
              y++;
         }
    }
    That MIGHT work, i havnt tested it yet, as i just wrote it..
    "There are three kinds of people in the world...
    Those that can count and those that can't."

  3. #3
    Registered User
    Join Date
    May 2002
    Posts
    7

    This is going to look lame

    This is as far as i got , i did have some attempts at some more code but i confused and it went horribly wrong

    /*Chris Dulewicz Parachute Club Database Program*/

    #include<stdio.h>
    #include<clib.h>
    #include<stdlib.h>
    #include<ctype.h>
    int main ()
    {
    char names_and_jumps[81]; /* Input is [81] as most computer screens have space for 80 characters*/

    puts("Please enter skydivers initials and jump numbers (i.e write if Tom Armstrong has 48 jumps, and Laurance Richardson has 32 and so on as :TA48LR32...:");
    gets(names_and_jumps);

  4. #4
    Unregistered
    Guest
    I could be wrong because i'm half way new, but wouldn't it be easier to use 2 variables.

    char name[80];
    int jumps;

    cout<<"Please enter skydivers initials and jump numbers (i.e write if Tom Armstrong has 48 jumps, and Laurance Richardson has 32 and so on as :TA48LR32...:";

    gets(name);
    cin>>jumps;



    like i said, i could be wrong, but i'm pretty sure this would work. I know you can use to cin statements in a row.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sorting a file with a lot of words.
    By samus250 in forum C Programming
    Replies: 28
    Last Post: 04-27-2008, 01:36 PM
  2. C(xx), Brag and Flame a lot!
    By xuftugulus in forum A Brief History of Cprogramming.com
    Replies: 62
    Last Post: 03-20-2008, 11:15 PM
  3. A lot can happen in 50 years
    By Salem in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 10-04-2007, 04:44 AM
  4. using fopen getting a lot of warnings
    By netiad in forum C Programming
    Replies: 1
    Last Post: 04-28-2007, 08:44 PM
  5. Still get error even if i changed a lot..
    By icefire99 in forum C++ Programming
    Replies: 9
    Last Post: 04-26-2007, 03:31 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21