Closed Thread
Results 1 to 9 of 9

Thread: Easy Projects [IDEAS]

  1. #1
    Ascension is offline Learning Programmer
    Join Date
    Dec 2008
    Posts
    42
    Rep Power
    0

    Easy Projects [IDEAS]

    Im quite new to C# and I'm only really half way through learning about classes, objects and properties. Does anyone have easy projects I can do to start programming small easy programs, to get some practice?

    Thanks,
    -Ascension

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Oct 2008
    Posts
    4,060
    Blog Entries
    6
    Rep Power
    45

    Re: Easy Projects [IDEAS]

    have you done a calculator? that should be small and easy
    Posted via CodeCall Mobile

  4. #3
    Ascension is offline Learning Programmer
    Join Date
    Dec 2008
    Posts
    42
    Rep Power
    0

    Re: Easy Projects [IDEAS]

    No i haven't done that. Can you give me a short step list. I have no idea where to start.

  5. #4
    Join Date
    Nov 2008
    Location
    Kosovo.
    Posts
    2,391
    Rep Power
    30

    Re: Easy Projects [IDEAS]

    n Basic Calculator program we have some Declaretion

    1) if Prefix of variable start with bttn this is BUTTON

    2) if Prefix of variable start with lb this is LABEL

    3) if Prefix of variable start with m_this is member variable for Example:

    *bttnD5 -> button Digit 5

    *bRes -> label result

    *m_Value-> member variable naming value

    So We have

    - 10 buttons digit (bttnD0->9)

    - 5 buttons operator (bttnPlus,bttnMinus,bttnMul,bttnDiv,bttnEqul)

    - 1 dot button bttnDot and 1 clear button bttnClr.

    - 1 labels for display display result (mlbRes)

    - m_value this to store data on it

    - m_store this arraylist to store all string in lbRes

    Also We will make 4 void function

    1)void AddToArray(Button bttn) this function to display Digit on lbRes

    and save this digit on m_value

    2)void AddOperatorToArray(Button bttn) this function to add m_value in

    m_Store then add operator to m_Store

    3)void Reset() this is to clear lbRes,m_value and m_Store

    4)void SetEnableOperatorBttns(bool enable) this sets operators to be enabled or not

    Example:- To How To use this Program ?

    Here we'll exmine how this program should work:

    - asume you want to calculate 2.2 + 0.8 - 1 * 3 / 2

    Just enter this Equation as we write here by click on buttons

    Important Note:-in this program we neglect the periorty of operators

    1) 2.2 + 0.8 = 3

    2) 3 - 1 = 2

    3) 2 * 3 = 6

    4) 6 / 2 = 3 # final answer

    how program work internaly?

    We will discuss what happened when we enter Any Equation

    Input: Equation :- 2 + 1.6 =

    Output: Result :- 3.6

    1) When you Press(click) on 2

    Code:
    private void bttnD2_Click(object sender, System.EventArgs e)
    {
        AddToArray(bttnD2);        
    }
    this subroutine or Event will call void function [AddArray(bttnD2)]

    this function do the following:

    [1] set the value equal 2

    [2] set label lbRes = 2 to display it to user

    [3] make all operator Enabled to use it

    Code:
    private void AddToArray(Button bttn)
    {
        //Step[1]
        m_value    += bttn.Text;
    
        //Step[2]
        lbRes.Text += bttn.Text;
    
        //Step[3]
        SetEnableOperatorBttns(true);
    }
    2) When you Press(click) on "+"

    Code:
    private void bttnPlus_Click(object sender, System.EventArgs e)
    {
           AddOperatorToArray(bttnPlus);
    }
    this subroutine or Event will call void function [AddOperatorArray(bttnPlus)]this function do

    [1]Add value in step 1) to arrayList

    [2]display on lbRes to user 2.2

    [3]make value empty

    [4]add operator to arraylist

    [5]make Dot button enabled

    [6]call SetEnableOperatorBttns(false); to make all operator unenabled

    (sure we can't make 2.2++)

    Code:
    private void AddOperatorToArray(Button bttn)
    {        
        //[1]
        m_store.Add( m_value );
        //[2]            
        lbRes.Text += bttn.Text;
        //[3]        
        m_value    = "";
        //[4]        
        m_store.Add( bttn.Text );
        //[5]            
        bttnDot.Enabled    = true;        
        //[6]        
        SetEnableOperatorBttns(false);
    }
    3) When you press(click) on 1 like step 1)

    4) When you Press(click) on "." this subroutine or Event will

    [1]make all things like step 1)

    [2]make dot unenabled because we can't make 2..2 ))),so after one click it will disable

    Code:
    private void bttnDot_Click(object sender, System.EventArgs e)
    {
        //[1]
        AddToArray(bttnDot);
        //[2]
        bttnDot.Enabled = false;
    }
    5) When you press(click) on 6 like step 1)

    6) When you press(click) on "="

    [1] add value to arrylist value = 6

    [2] add operator to arrylist "="

    [3] take the first element in array sure it's digit and save it on m_res else it will give exception

    [4] make forLoop on arraylist and check every element if equal to operator or not (+,-,/,*) if equal operator

    (1)make make dispaly screen empty

    (2)make calculation

    (3)display res on screen

    [5] make arraylist empty

    [6] make m_value = lbRes

    [7] check if m)value has dot or not because we can't make 2.2.2 this step handle this format

    [8] make Equalbttn disable
    Code:
       private void bttnEqual_Click(object sender, System.EventArgs e)
       {
          try
          {
        //[1]
        m_store.Add(m_value);
        //[2]
        m_store.Add( bttnEqual.Text );
    
        /* m_res here take the first element in m_store if this element is  
    
        * operator like +*-/ Exception give us Error else it will take the
        *  Digits or dot point  
        */
    
        //[3]        
        float m_res = float.Parse ( m_store[0].ToString() );
            
        /* this loop extract all element in Array then check it  
    
         * if the element is operator it will calculate the prefix  
         * and postfix and give us the result  
         * Example 1+2/3*5  
         * 1) 1+2 = 3
         * 2) 3/3 = 1
         * 3) 1*5 = 5
         * note:- no periority operator and no brakets so it's basic calculator:)
        */
    
        //[4]
        for( int i = 0 ;  i{
          if( m_store[i].ToString() == "+" )
          {
            lbRes.Text="";//(1)
            m_res += float.Parse (m_store[i+1].ToString());//(2)
            lbRes.Text = m_res.ToString();//(3)            
          }
          else if( m_store[i].ToString() == "-" )
          {
            lbRes.Text="";//(1)
            m_res -= float.Parse (m_store[i+1].ToString());//(2)
            lbRes.Text= m_res.ToString();//(3)            
          }
          else if( m_store[i].ToString() == "*" )
          {
            lbRes.Text="";//(1)            
            m_res *= float.Parse ( m_store[i+1].ToString() );//(2)            
                lbRes.Text= m_res.ToString();//(3)                    
          }
          else if( m_store[i].ToString() == "/" )
          {
            lbRes.Text=    "";//(1)            
            m_res /= float.Parse ( m_store[i+1].ToString() );//(2)            
            lbRes.Text= m_res.ToString();//(3)                    
          }
            
        }
           m_store.Clear();//[5]
           m_value = lbRes.Text;//[6]
    
        for( int i = 0 ; i < m_value.Length ; i++ )//[7]
        {
              if( m_value[i].ToString() == "." )
          {
            bttnDot.Enabled = false;
            break;
          }
          else
          {
            bttnDot.Enabled = true;
          }
        }
    
        bttnEqual.Enabled = false;//[8]
         }
         catch(Exception exception)
         {
        MessageBox.Show(exception.Message,"Error");
         }
       }
    Conclusion

    This was very simple C# application for beginers, this will put your hand on C# language and prepare you start programming with .Net Framework.
    Last edited by Jaan; 12-20-2008 at 05:39 AM. Reason: Please use code tags when you're posting your codes!

  6. #5
    Datab0x's Avatar
    Datab0x is offline Newbie
    Join Date
    Oct 2008
    Posts
    14
    Rep Power
    0

    Re: Easy Projects [IDEAS]

    After you do the calculator you could try making Tick-Tack-Toe or a Binary clock. Those were the two projects that we worked on in my C# class after the calculator.

  7. #6
    Join Date
    Mar 2008
    Location
    The North Pole
    Posts
    13,174
    Blog Entries
    13
    Rep Power
    114

    Re: Easy Projects [IDEAS]

    This is about the most frequently asked C# question here. Look through some older threads for ideas. Perhaps an RSS Reader, a database system, etc.

    Quote Originally Posted by Jordan View Post
    Good members, like yourself, stick around and post for ages to come!
    Mr. Xav | Blog | Forums

  8. #7
    Ascension is offline Learning Programmer
    Join Date
    Dec 2008
    Posts
    42
    Rep Power
    0

    Re: Easy Projects [IDEAS]

    thanks. I think I will keep reading the book I am learning from because I have not learned buttons and forms. Any suggestions for even easier projects? Thanks

  9. #8
    Join Date
    Mar 2008
    Posts
    7,145
    Rep Power
    86

    Re: Easy Projects [IDEAS]

    Calculators are very easy. How about a paint application?

  10. #9
    Join Date
    Mar 2008
    Location
    The North Pole
    Posts
    13,174
    Blog Entries
    13
    Rep Power
    114

    Re: Easy Projects [IDEAS]

    RSS Readers are also easy, with a lot of scope for expansion.

    Quote Originally Posted by Jordan View Post
    Good members, like yourself, stick around and post for ages to come!
    Mr. Xav | Blog | Forums

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Looking for VB projects
    By jojofromjory in forum Visual Basic Programming
    Replies: 2
    Last Post: 04-11-2010, 02:43 AM
  2. looking for a programmer(help for projects)
    By gogetax1 in forum Pascal and Delphi
    Replies: 3
    Last Post: 02-16-2010, 02:32 PM
  3. Releasing Projects
    By Datab0x in forum C and C++
    Replies: 5
    Last Post: 12-20-2008, 11:54 AM
  4. Your Projects or Programms !
    By mendim. in forum The Lounge
    Replies: 24
    Last Post: 12-09-2008, 05:06 PM
  5. What projects do you have going?
    By dirkfirst in forum The Lounge
    Replies: 14
    Last Post: 10-28-2007, 12:56 PM

Tags for this Thread

Bookmarks

Posting Permissions

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