Sign in to follow this  
0xwarning

Learn C# | Little Codes

Recommended Posts

If you have ever wanted to learn c# for multiple purposes.

Then here is your answer.

 

[hide]

Lets Get Started

 

You Will Need

Visual Studio.

Make Sure To Have C# Installed.

 

So I'm Currently using a windows form.

 

Have A Layout of what you want but

here is mine for an example.

Make Sure the listbox is names lstOutput or adapt it in your code to your list box name.

 

Code

Integers And Strings.

Max Int Value And Max int value

           int intA = 10;
           int intB = 20;
           int intC = 50;
           int intD = 25;

           int intRes = intA + intB * intC - intD;
           string resstr = "Result of ";
           string maxstr = "C  "; // Hint Max Int Value
           string minstr = "D "; // Hint Opposite The Max
           string resultstring = resstr + intA.ToString() + " + " + intB.ToString() + " X " + intC.ToString() + " - " + intD.ToString() +  " = " + intRes.ToString();

           lstOutput.Items.Add(resultstring);
           lstOutput.Items.Add(maxstr + int.intC); // Hint int.M
           lstOutput.Items.Add(minstr + int.intD);

Basic Thread i will adapt to this in a couple of days.

 

Now try to make the code display Max And Min Int Value

I Have Left Some Hints

 

If Successful here is the code you should have

           int intA = 10; // ADD
           int intB = 20; // ADD
           int intC = 50; // Times
           int intD = 25; // Subtract

           int intRes = intA + intB * intC - intD; // Result
           string resstr = "Result of "; // Text Displaying The Result
           string maxstr = "Max int value "; // Text Displaying Max Int Value
           string minstr = "Min int value "; // Text Displaying Min Int Value
           string resultstring = resstr + intA.ToString() + " + " + intB.ToString() + " X " + intC.ToString() + " - " + intD.ToString() +  " = " + intRes.ToString(); // Putting it all together to look cleaner when calling the string

           lstOutput.Items.Add(resultstring); // AddTo ListBox And Displays ResultString
           lstOutput.Items.Add(maxstr + int.MaxValue); // AddTo ListBox And Displays Max int
           lstOutput.Items.Add(minstr + int.MinValue); // AddTo ListBox And Displays Min Int

[/hide]

 

Share this post


Link to post
Share on other sites

Time to learn :) and thank you for sharing you know knowledge to us!

Share this post


Link to post
Share on other sites

If you have ever wanted to learn c# for multiple purposes.

Then here is your answer.

 

 

 

 

 

thank you dude

Share this post


Link to post
Share on other sites

If you have ever wanted to learn c# for multiple purposes.

Then here is your answer.

 

 

 

 

 

KNWOLEGE IS POWER BROTHERS

Share this post


Link to post
Share on other sites

Whaile thats prob. nice

Share this post


Link to post
Share on other sites

thanks for sharing :hype: :hype: :hype: :fiesta: :fiesta: :fiesta: :fiesta: :fiesta:

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this