Jump to content
Sign in to follow this  
Matrix

C# Coding problems

Recommended Posts

Recently I have been assigned something that has been frustrating me. After learning a couple other codes i decided to move on to another language. This one has been assigned to me and there is one part that i cant seem to get right at all. If anyone could do this code for me and send it to me so i can see how it is done that would be awesome. i do know there are alot of smart coders in the community and im hoping someone can help me out here.

The attached files shows what is asked of me and what is needed to be done, i was wondering if someone could send me the working code for this

Thanyou, and enjoy the rest of your Day/Night

Capture.PNG

Share this post


Link to post
Share on other sites

Although I do not know C#, I have done similar things in other languages.  Through researching some of the functions and with my slight knowledge of other languages, I will try to come up with a solution and I will add it to the bottom of this reply. Just downloading visual studio  monodevelop again now to run it and make sure it works.

Share this post


Link to post
Share on other sites
2 minutes ago, Quebec said:

Although I do not know C#, I have done similar things in other languages.  Through researching some of the functions and with my slight knowledge of other languages, I will try to come up with a solution and I will add it to the bottom of this reply. Just downloading visual studio again now to run it and make sure it works.

Echo u are a legend

Share this post


Link to post
Share on other sites
13 minutes ago, Matrix said:

Echo u are a legend

Sadly, it doesn't seem like monodevelop wants to work, and I dont have enough time right now to get it to work. Gonna have to get someone else to help you 😕

Share this post


Link to post
Share on other sites
1 minute ago, Quebec said:

Sadly, it doesn't seem like monodevelop wants to work, and I dont have enough time right now to get it to work. Gonna have to get someone else to help you 😕

haha no worries, thanks for trying

Share this post


Link to post
Share on other sites
1 minute ago, Matrix said:

haha no worries, thanks for trying

I will certainly help you if I get some free time, but monodevelop is being a cunt and i have math homework + 2 assignments and a test

Share this post


Link to post
Share on other sites
2 hours ago, eleventeen said:

scratch is better

Tru, but i need this for class, and i am stoopid

Share this post


Link to post
Share on other sites

I can probably help you give me quarter of an hour

 

I can help you give me quarter of an hour

Share this post


Link to post
Share on other sites

probs a better way of doing this but I made this in like a minute

 

using System;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Matrix fucken 1 if you wanna be a pig 2 if you wanna be a mp, same thing but you get the point");
            string matrixbetterpayme = Console.ReadLine();

            if (matrixbetterpayme.Contains("1"))
            {
                Console.WriteLine("goodboi");
            }
            else if (matrixbetterpayme.Contains("2"))
            {
                Console.WriteLine("naughtyboi");
            }
        }
    }
}
 

 

this should give you an idea of what you need to do. also I have never really wrote a console application before but if you are allowed to do windows forms you can do it like this

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == ("gay"))
            {
                if (textBox2.Text == ("dad"))
                {
                    if (textBox3.Text == ("fary"))
                    {
                        MessageBox.Show("Your a gay dad fary!");
                    }
                }
            }
            else if (textBox1.Text == ("straight"))
            {
                if (textBox2.Text == ("dad"))
                {
                    if (textBox3.Text == ("fury"))
                    {
                        MessageBox.Show("Your a straight dad fury!");
                    }
                }
            }
        }
    }
}
 

 

I just noticed instead of doing separate ifs you could make it alot more clean and do it like this

 

else if (textBox1.Text == ("straight") && textBox2.Text == ("dad") && textBox3.Text == ("fury"))

{

//Your mum gay

}

 

 

and incase you need to explain it to your brain dead class

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; //Includes to make it work

namespace WindowsFormsApp3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            
        }

        private void button1_Click(object sender, EventArgs e) //This means someone has clicked button1
        {
            if (textBox1.Text == ("gay")) //This is seeing what the user has inputted to textbox1 and checking if that is = to gay
            {
                if (textBox2.Text == ("dad"))
                {
                    if (textBox3.Text == ("fary"))
                    {
                        MessageBox.Show("Your a gay dad fary!");
                    }
                }
            }
            else if (textBox1.Text == ("straight")) //This is seeing what the user has inputted to textbox1 and checking if that is = to straight
            {
                if (textBox2.Text == ("dad"))
                {
                    if (textBox3.Text == ("fury"))
                    {
                        MessageBox.Show("Your a straight dad fury!");
                    }
                }
            }
        }
    }
}

 

or if your using the shitty console app I made

 

using System;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Matrix fucken 1 if you wanna be a pig 2 if you wanna be a mp, same thing but you get the point"); //Writing a line in the console telling the user what to do
            string matrixbetterpayme = Console.ReadLine(); //Gathering the information that the user inputted

            if (matrixbetterpayme.Contains("1")) //Checking if the user inputted 1
            {
                Console.WriteLine("goodboi");
            }
            else if (matrixbetterpayme.Contains("2")) //Checking if the user inputted 2
            {
                Console.WriteLine("naughtyboi");
            }
        }
    }
}

 

also if you use the console app you will need to set a break point in visual studio after (Console.WriteLine("naughtyboi");  so it dose not crash if you dont know how to do it, just do this https://gyazo.com/b591ecd5d6591b0139ab67e6cf37f1fb :^) I hope I helped 

Edited by Tucker

Share this post


Link to post
Share on other sites

(wrote at 6 am in the morning with 0 sleep, dont judge my spelling or if I did something dumb as fuck in the code)

Share this post


Link to post
Share on other sites

too lazy to write the full thing out. give him an example with it like this tucker

static void Main(string[] args)
    {
        int intUserInput = 0;
        bool validUserInput = false;
        
        while (validUserInput == false)
        {
            try
            { Console.Writeline("Please choose a race. 1 = Human. 2 = Dwarf. 3 = Elf.");
              intUserInput = int.Parse(Console.Readline()); //attempt to parse input as int variable
            }
            catch (Exception) { } //catch invalid input exception
            
            if ( (intUserInput >= 1) && (intUserInput <= 3) ) //ensure entered int is >= 1
              { validUserInput = true; }
            else { Console.Writeline("Invalid Input.  "); }
        }
        
        Console.Writeline("You Entered " +intUserInput);
    }

Share this post


Link to post
Share on other sites

Thank me later son, i've done your school project for you. 

on a side note, if you have questions about what everything does so you actually learn something. hit me up

https://pastebin.com/ZZqtwB3t

Script is all in the pastebin. works aswell a bit bloated though, i've been awake for a long time.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×