Thread: Char Arrays

  1. #1
    Refugee face_master's Avatar
    Join Date
    Aug 2001

    Thumbs up Char Arrays

    How would you get a program to search char arrays for single words?


    #include <iostream.h>
    #include <stdlib.h>
    int main()
      char sentence[25];
      cout << "Enter a sentence: ";
      cin.getline(sentence, 25);
      return 0;
    What would I add to this code to make it search for the word "Chris" in the sentence?

    Last edited by face_master; 09-01-2001 at 01:27 AM.

  2. #2
    Join Date
    Aug 2001
    mming, Game DevelopmentCSR >&<>&2Minimization of boolean functions, PROM,PLA design >&0>&WA, USA guitar, dogsCommercial Aviation >&>>&USAProgramming
    strstr() searches for a substring and returns a pointer to the location of the substring if it exists. Otherwise it returns NULL.
    I compile code with:
    Visual Studio.NET beta2

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Obtaining source & destination IP,details of ICMP Header & each of field of it ???
    By cromologic in forum Networking/Device Communication
    Replies: 1
    Last Post: 04-29-2006, 02:49 PM
  2. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 11:58 AM
  3. comparing fields in a text file
    By darfader in forum C Programming
    Replies: 9
    Last Post: 08-22-2003, 08:21 AM
  4. String sorthing, file opening and saving.
    By j0hnb in forum C Programming
    Replies: 9
    Last Post: 01-23-2003, 12:18 AM