Variable in programming
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Variable in programming

  1. #1
    Join Date
    Jan 2011
    Posts
    3

    Unhappy Variable in programming

    Write a program that checks the properness of a given variable name. More specifically, your
    program should specify whether a user-entered variable name is (1) illegal, (2) legal, but uses poor
    style, or (3) good. There are different opinions as to what constitutes good style for a variable name.
    For this program, check for good style using these rules:

     Only use letters and digits.
     Use a lowercase letter for the first character.

    You donít need to check for an uppercase letter for the first letter in the second word, third word, etc.

    Sample session:

    This program checks the properness of a proposed Java variable name.
    Enter a variable name (q to quit): streetAddress2
    Good!
    Enter a variable name (q to quit): street address2
    Illegal.
    Enter a variable name (q to quit): StreetAddress2
    Legal, but uses poor style.
    Enter a variable name (q to quit): 2ndStreetAddress
    Illegal.
    Enter a variable name (q to quit): street$address$2
    Legal, but uses poor style.
    Enter a variable name (q to quit): q

  2. #2
    Join Date
    Jan 2011
    Location
    South Africa
    Posts
    2

    Re: Variable in programming

    Hi

    I doubt anyone is going to help you without some effort on your side, post some code where you tried to do this, and we'll go from there.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center