locked
Sir i wrote my first program its not working, what i do. C# RRS feed

  • Question

  • using system;
    using system.collections.generic;
    using system.lenq;
    using system.text;
       namespace lifeSaver
        {
                    class died
                     {

                                static int addValue(int safe, int man)
             {
                        safe = i;
                        man = d;
             }
      if ( i >= d)
           i++;
     else ( d >= i)
           d++;
      {
                addValue( i , d )
               
            public died( i : 42, d : 0)
             {
                  42 / 0;
                  this.i;
                  this.d;
            if ( this.i == this.d ) && ( this.d != this.i )
                               
                                     infinity++;
            else ( this.d <= this.i ) && ( this.i >= this.d)
                           
                           infinity--;
               }
                                             return;

    • Edited by AlRk09 Thursday, March 10, 2016 10:23 AM i will forget which lang use
    Thursday, March 10, 2016 10:19 AM

Answers

  • Here you go. Not exactly what you were looking for but still something to get you started. This code is for a Console app in C#.

    using System;
    
    namespace ConsoleApplication3
    {
      class Program
      {
        static void Main(string[] args)
        {
          Divide d = new Divide();
          int result = 0;
          for (int x = 0; x < 100; x++)
          {
            for (int y = 0; y < 100; y++)
            {
              result = d.TryValues(x, y);
              Console.WriteLine("{0} / {1} = {2}", x, y, result);
            }
          }
        }
      }
    
      public class Divide
      {   
        public int TryValues(int i, int d)
        {
          int died = 0;
          try
          {
            died = i / d;
          }
          catch(DivideByZeroException dbz)
          {
            Console.WriteLine(dbz.Message);
            died = -1;
          }
          return died;
        }
      }
    }


    Best wishes, Davin Mickelson

    • Marked as answer by AlRk09 Sunday, March 13, 2016 4:10 AM
    Saturday, March 12, 2016 9:22 AM
    Answerer

All replies

  • Hi, AlRk09.

    Can you tell me what the program is supposed to do?


    Best wishes, Davin Mickelson

    • Marked as answer by AlRk09 Friday, March 11, 2016 11:02 AM
    • Unmarked as answer by AlRk09 Friday, March 11, 2016 11:02 AM
    Thursday, March 10, 2016 6:05 PM
    Answerer
  • sir I am trying to write just some thing,
    Friday, March 11, 2016 10:08 AM
  • Since you posted in the Training and Certification forum, but your question is "technical", not related to Training and Certification, I suggest that you post it in the C# forum:

    https://social.msdn.microsoft.com/Forums/vstudio/en-us/home?forum=csharpgeneral

    Note that you will need to post a clearer question. "It is not working" is not a valid question. You should explain HOW it is not working: what kind of errors you get, detailed error message, the line in which the error occurred, expected behavior versus observed behavior, etc.

    Friday, March 11, 2016 10:13 AM
  • thanks, sir I want just see some new technics error, unexpected if, class ,struct, interface members declaration,
    • Edited by AlRk09 Friday, March 11, 2016 11:05 AM
    Friday, March 11, 2016 10:21 AM
  • Here you go. Not exactly what you were looking for but still something to get you started. This code is for a Console app in C#.

    using System;
    
    namespace ConsoleApplication3
    {
      class Program
      {
        static void Main(string[] args)
        {
          Divide d = new Divide();
          int result = 0;
          for (int x = 0; x < 100; x++)
          {
            for (int y = 0; y < 100; y++)
            {
              result = d.TryValues(x, y);
              Console.WriteLine("{0} / {1} = {2}", x, y, result);
            }
          }
        }
      }
    
      public class Divide
      {   
        public int TryValues(int i, int d)
        {
          int died = 0;
          try
          {
            died = i / d;
          }
          catch(DivideByZeroException dbz)
          {
            Console.WriteLine(dbz.Message);
            died = -1;
          }
          return died;
        }
      }
    }


    Best wishes, Davin Mickelson

    • Marked as answer by AlRk09 Sunday, March 13, 2016 4:10 AM
    Saturday, March 12, 2016 9:22 AM
    Answerer
  • This is not code block at all. Please try to write full code. Then we could help you. Thanks.
    Sunday, March 13, 2016 3:35 AM