Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

program help

Name: mike redwood 2007-11-06 1:23

hey everyone
i just got virtual c# 2005 from microsoft's site and i want to use my old programs in it
i patsed the code in but it just gave me a bunch of errors
i asked a friend about it and he said this place was good for programming help

here's the code:
<CODE>
Module Module1

    Sub Main()

        Dim Average As Integer ' Holds the Average of the two numbers
        Dim Number1 As Integer ' Holds the first number
        Dim Number2 As Integer ' Holds the second number
        Dim Temporary As Integer ' Holds the number in between calculations

NumberOne:
        Console.WriteLine("Please Enter number one:")
        Temporary = Console.ReadLine()
        If Temporary = 0 Then GoTo NumberOne
        Number1 = Temporary
        Temporary = 0

NumberTwo:
        Console.WriteLine("Please Enter numbr two:")
        Temporary = Console.ReadLine()
        If Temporary = 0 Then GoTo NumberTwo
        Number2 = Temporary
        Temporary = 0

        Average = Average + Number1
        Average = Average + Number2
        Average = Average / 2

        Console.WriteLine("The Average of" & Number1 & "and" & Number2 & "is:")
        Console.WriteLine(Average)
        Console.ReadLine()

    End Sub

End Module
</CODE>

and here's the errors:
<CODE>Error    1    Newline in constant    C:\Documents and Settings\Mike\Local Settings\Application Data\Temporary Projects\ConsoleApplication1\Program.cs    5    32    ConsoleApplication1
Error    2    Too many characters in character literal    C:\Documents and Settings\Mike\Local Settings\Application Data\Temporary Projects\ConsoleApplication1\Program.cs    5    32    ConsoleApplication1
Error    3    Newline in constant    C:\Documents and Settings\Mike\Local Settings\Application Data\Temporary Projects\ConsoleApplication1\Program.cs    6    32    ConsoleApplication1
Error    4    Too many characters in character literal    C:\Documents and Settings\Mike\Local Settings\Application Data\Temporary Projects\ConsoleApplication1\Program.cs    6    32    ConsoleApplication1
Error    5    Newline in constant    C:\Documents and Settings\Mike\Local Settings\Application Data\Temporary Projects\ConsoleApplication1\Program.cs    7    32    ConsoleApplication1
Error    6    Too many characters in character literal    C:\Documents and Settings\Mike\Local Settings\Application Data\Temporary Projects\ConsoleApplication1\Program.cs    7    32    ConsoleApplication1
Error    7    Newline in constant    C:\Documents and Settings\Mike\Local Settings\Application Data\Temporary Projects\ConsoleApplication1\Program.cs    8    34    ConsoleApplication1
Error    8    Too many characters in character literal    C:\Documents and Settings\Mike\Local Settings\Application Data\Temporary Projects\ConsoleApplication1\Program.cs    8    34    ConsoleApplication1
Error    9    A namespace does not directly contain members such as fields or methods    C:\Documents and Settings\Mike\Local Settings\Application Data\Temporary Projects\ConsoleApplication1\Program.cs    1    1    ConsoleApplication1
</CODE>

anyways thanks in advance for the help =o)

Name: Anonymous 2007-11-06 2:01

hi Mike

Name: mike redwood 2007-11-06 2:22

hi

Name: Anonymous 2007-11-06 3:19

sup Mike

Name: Anonymous 2007-11-06 4:19

Mike!

Name: Anonymous 2007-11-06 4:58

HEY MIKE HOWS IT GOING

Name: Anonymous 2007-11-06 5:14

You are trying to build a VB.NET program in the C# compiler.

IHBT.

Name: Anonymous 2007-11-06 5:30

anyone remembers bigmike? lol

Name: Anonymous 2007-11-06 5:45

>>8
no, but I remember B1FF, newfag.

Name: Anonymous 2007-11-06 7:19

>>8
no

-bigmike

Name: Anonymous 2007-11-06 8:52

hey everyone
i just got virtual c# 2005 from microsoft's site

hey everyone
i just got virtual c# 2005 from microsoft's site


virtual

Name: Anonymous 2007-11-06 10:50

>>11
He's a .NET faggot, what do you expect?

Name: Anonymous 2007-11-06 10:50

Name: Anonymous 2007-11-06 11:43

Fall/Semester Mike?

Name: Anonymous 2007-11-06 11:46

Fall/Semester Mike?

Name: Anonymous 2007-11-06 13:34

thread is epic fail.

Name: Anonymous 2007-11-06 17:14

Is this some sort of XML/VB hybrid?

Name: Anonymous 2007-11-06 18:28

THE CODE, MY EYES, IT'S UGLY.
WHAT IS THIIIIIS SHIT????

Name: mike redwood 2007-11-07 18:05

any one got any idea how to fix it???

Name: Anonymous 2007-11-07 18:51

Nope, your code is flawless. I can't see a single thing wrong with it.

Name: mike redwood 2007-11-07 19:02

why doesnt it work then?

Name: Anonymous 2007-11-07 19:30

You need to put it in backwards.

Name: Anonymous 2007-11-07 19:57

EXPERT TROLL IS EXPERT.

Name: mike redwood 2007-11-07 20:35

how do i put it in backwards

Name: Anonymous 2007-11-07 21:10

HAHA

Trying to compile VB.NET code as C#.NET.

Fail.

Try using a .vb file instead of a .cs file.

Name: Anonymous 2007-11-08 15:42

To be helpful, because everyone else seems to only berate you for your ignorance, here's what's wrong:

The program is written in a language called VB.NET. You are using a C# compiler. You can only compile C# programs with a C# compiler.

Please, make sure your computer is plugged in before trying to turn it on.

Name: mike redwood 2007-11-08 17:30

how do i make it c#

Name: Anonymous 2007-11-08 19:08

>>27
First test if it really is a compiler. Do the C# equivalent of
while(1) printf "#658h2h"

This is a well known compiler-test, if you run it in command line for 8 hours, and check back after 8 hours, the tests will be finished, and it should give you instructions on converting your code (Which you should enter after the tests are done).

Name: Anonymous 2007-11-08 19:11

Just put this at the top:


'#pragma language c#

Name: Anonymous 2007-11-08 19:41

Very good advice from >>28 and >>29!

Name: Anonymous 2007-11-08 19:47

You can change the file extension to .vb, but you will never be an EXPERT PROGRAMMER

Name: mike redwood 2007-11-08 20:12

how do i learn to be a nexpert?

Name: Anonymous 2007-11-08 21:10

>>32
Read SICP.

GODLY TROLL IS GODLY.

Name: mike redwood 2007-11-08 21:49

whats that

Name: Anonymous 2007-11-08 22:18

Okay, Mike, Michael, Mickey. You need to find someone who is willing to help you here. I could translate it, if I knew C#, but I don't. Here's the C version, which may, or may not, work in C# as-is:

#include <stdio.h>

int main (void) {
   int N1, N2;

   do {
      printf("Please eter number one: ");
      scanf("%d", &N1);
   } while (N1);

   do {
      printf("Please eter number two: ");
      scanf("%d", &N2);
   } while (N2);

   printf("The average of %d and %d is %d.", N1, N2, (N1 + N2) / 2);
   getchar();

   return 0;
}

Name: Anonymous 2007-11-08 22:24

>>35
Change
   } while (N1);
and
   } while (N2);
to
   } while (!N1);
and
   } while (!N2);
.

Name: Anonymous 2007-11-08 23:03

>>26
welcome to 4chan. now GTFO.

Name: Anonymous 2007-11-08 23:24

>>37
Bittez-moi!
>>35
Can also remove the getchar(); line; it does nothing at the moment. My bad.

Name: mike redwood 2007-11-08 23:39

that looks way too different
you dont even have Console in front of anything

Name: Anonymous 2007-11-09 1:49

lol java

import java.io.*;
public class NumberAverage {
   private int numberOne;
   private int numberTwo;
   public NumberAverage()
   {
      numberOne = 0;
      numberTwo = 0;
   }

   private int getNumber()
   {
      int toReturn = 0;
      String temp = "";
      boolean continueLoop = false;

      do
      {
         try
         {
            BufferedReader b = new BufferedReader(new InputStreamReader(System.in));
            temp = b.readLine();
         }
         catch (Exception e)
         {
            System.out.println("Its Broken");
            System.exit(0);
         }
         continueLoop = false;
         try
         {
            toReturn = Integer.parseInt(temp);
         }
         catch(NumberFormatException e)
         {
            System.out.println("Enter a Number Next Time");
            continueLoop = true;
         }       
      } while(continueLoop);

      return toReturn;
   }

   public void setNumberOne()
   {
      numberOne = getNumber();
   }

   public void setNumberTwo()
   {
      numberTwo = getNumber();
   }

   public int getAverage()
   {
      return (numberOne + numberTwo) / 2;
   }

   public int getNumberOne()
   {
      return numberOne;
   }
   public int getNumberTwo()
   {
      return numberTwo;
   }

   public static void main(String[] args)
   {
      NumberAverage n = new NumberAverage();

      System.out.print("Enter the first Number: ");
      n.setNumberOne();
      System.out.println();
      System.out.print("Enter the second Number: ");
      n.setNumberTwo();
      System.out.printf("\n\nThe Average of the numbers %d and %d is %d\n", n.getNumberOne(), n.getNumberTwo(), n.getAverage());
   }
}

Name: Anonymous 2007-11-09 3:12

>>40
WHY IS IT SO FUCKING BLOATED

Name: Anonymous 2007-11-09 3:27

>>41
It's not bloated, it's ENTERPRISE.

Name: Anonymous 2007-11-09 4:54

>>40
This somehow looks ENTERPRISE.

Name: Anonymous 2007-11-09 6:24

>>43
Protip: It could be ALOT more ENTERPRISE.

Name: Anonymous 2007-11-09 6:29

yeah it doesn't even have any comments or gotos

Name: Anonymous 2007-11-09 9:28

>>1
protip: read a book on programming before looking to 4chan for help. If you can't tell one language from another or blatantly demonstrate that you don't know your shit you aren't going to ever get a straight answer...

and wear flameproof clothing

Name: Anonymous 2007-11-09 10:11

>>35 >>40
Just more proof that C is better, though bugier, than Java.

Name: Anonymous 2007-11-09 10:37

Does this look better, Mike:


#include <stdio.h>

#define ConsoleWrite printf
#define ConsoleRead scanf
#define then

int main (void)
{
   int Number1, Number2, Average;

NumberOne:
   ConsoleWrite ("Please enter number one: ");
   ConsoleRead ("%d", &Number1);
   if (Number1 == 0) then goto NumberOne;

NumberTwo:
   ConsoleWrite ("Please enter number two: ");
   ConsoleRead ("%d", &Number2);
   if (Number2 == 0) then goto NumberTwo;

   Average = (Number1 + Number2) / 2;

   ConsoleWrite ("The average of %d and %d is %d.", Number1, Number2, Average);

   return 0;
}

Name: Anonymous 2007-11-09 15:25

You've all been trolled, fools.

Name: Anonymous 2007-11-09 22:11

>>49
yhbt

Name: Anonymous 2009-03-06 8:26

The topic or is   it just your   way to say   There is not   good enough Learn.

Name: Anonymous 2009-03-06 13:23

y you should choose your operators properly   and if none   fit use a   Calculator your fine   I have been   struggling to find   love off the   Lisp machines get?

Name: ​​​​​​​​​​ 2010-10-21 16:56

Name: Anonymous 2010-11-14 6:36

Name: Anonymous 2011-01-31 21:27

<-- check em dubz

Name: Anonymous 2011-02-04 14:52

<

Don't change these.
Name: Email:
Entire Thread Thread List