Thread: Entering specific data

  1. #1
    Registered User
    Join Date
    Feb 2005

    Entering specific data

    Ok newbie here. I got a question. I'm trying to write a program that reads a string from someone and gives an if-then-else result. Here's what I've done, can someone point out what I'm doing wrong?
    PHP Code:

    #include <stdio.h>

    void main(void)
    char name;                //input variable
    char f;                //input variable
    char lname;                //input variable
    char mname;            //input variable

    printf ("What is your First Name?");

        if (
    f=="fantim") || (== "Fantim") || (== "FANTIM"))
    printf ("What is your middle name?");
    scanf ("%d", &mname);
            if ((
    mname == "mi") || (mname == "Mi") || (mname =="MI"))
    printf ("What is your last name?");
    scanf ("%d", &lname); 
    Of corse this isn't where the code stops, but this is where my problems are coming in.

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    1) void main is not valid. Please check the FAQ for details
    2) You can't compare a single character to a string literal.
    3) Fix your indentation

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. data structure design for data aggregation
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 05-20-2008, 06:43 AM
  2. Replies: 5
    Last Post: 03-22-2008, 12:49 PM
  3. [question]Analyzing data in a two-dimensional array
    By burbose in forum C Programming
    Replies: 2
    Last Post: 06-13-2005, 07:31 AM
  4. C diamonds and perls :)
    By Carlos in forum A Brief History of
    Replies: 7
    Last Post: 05-16-2003, 10:19 PM
  5. function to prompt user to continue entering data or not
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 05-05-2002, 06:38 PM