The Final Fantasy Forums  

Go Back   The Final Fantasy Forums > Auditorium > Digital Community

Digital Community Come here for all things digital and technological! Inside, you'll find things like hardware talk, software help, coding issues, and layout tips, among other things.

Reply
 
LinkBack Thread Tools Display Modes
 
Old 10-01-2008, 11:48 AM Level: 22  HP: 231 / 545
Unknown Entity's HP
EXP: 82%
Unknown Entity's XP
  #1 (permalink)
† The Fallen Angel †
 
Unknown Entity's Avatar
 

Join Date: Feb 2008
Location: London, England.

   Posts    623
        

Send a message via MSN to Unknown Entity

C# Anyone?

I got on a computer programming course, and it seems to be ok so far. However, I'm having a little trouble learning the language C#.

I was wondering if there was anyone on here who has worked with/knows this computer language, and if they wouldn't mind helping me out a little bit.

Maybe if you have any tips, could you post them here? It would be a great help!
__________________
"I think I want to be forgiven... More than anything."
My dearest TFF boyfriend, Martin... Much love... <3
"Are sins ever forgiven?"

My GREAT TFF Family, and some good quotes!:


All my banners are now done by me! Soon, I will be great! Muwahahahaha... ha... eck! *coughs* ...ha!

(If you'd like to join my family, send me a PM! You are more than welcome!)

My Fab Mum, Athna Loveil; My Ace Pilot FF Ace Cid; My car mad, Manchester United FC and Rochdale Fan brother The Migthy Dale; My loopy sibling who loves sugar, Crazy Chocobo; My super cool nephew Rasler+; My In Heaven with FFVII brother, Secret Weapon; My hilarious 'friend', loner-kid; My Old Skooler cousin, Silver; My totally odd, but totally cool brother, Raider; My self absorbed brother, Morik the Rogue; My terror brother, Rocky; My totally awesome sister, winterborn86; My Flying Cookie Monster Nepew, Mr Spike; Johto remake hunter aunt, Refieth; My Mastermind of FF Trivia half-brother, Phantom; My omonus and mysterious sister, Neggropino; My Metal and Tattoo loving sister, Kat; My comically egotistical uncle, Sharzademar; My lovely book writting sister, Dizz; My FF obsessed sister, brnthsdiscout; My creepy uncle who you bet could be a rapist, Jesus Christ; My sci-fi and fantasy-addicted uncle, Dragon_Jiriki; My potatoe munching owner, Bleachfangirl; My "The God Father" brother, Dark Squall


You can see everything if you take the time to look.

What we think is real is only as real as what our minds make it.


Quotes from you guys, my mates and some random ones to have a giggle at.:

Quote:
Originally Posted by Bleachfangirl
I'm none too scary really. Just somewhat violent... hehe...
Quote:
Originally Posted by Martin
My name is Martin J. Cullen. And I approve of these awards. And I deserve 69.3 no... 69.4% of them.
Quote:
Originally Posted by Dark Squall
F**K, I lost my sig!
Quote:
Originally Posted by Sylvie (Vaperida)
Hah. You gave Mikey moodswings. He's schitzophrenic like Harry Potter!
Quote:
Originally Posted by Cathy L. Poulin
"I believe most at-home accidents happen in the bathroom because our Guardian Angels give us our privacy".

Biggest fan of Peanut Butter created by The Xeim and Halie Peanut Butter Corporation ^_^

Unknown Entity is offline
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
 
 
Old 10-01-2008, 06:13 PM Level: 65  HP: 1171 / 1622
Merlin's HP
EXP: 91%
Merlin's XP
  #2 (permalink)
Magically Delicous
 
Merlin's Avatar
 

Join Date: Jan 2001
Location: Quel'thalas

   Posts    10,447
        
Romandan Pistol

Send a message via AIM to Merlin


I haven't touched it in a while, but I can help out if you need it. I'm quite proficient in C-based languages so ask away.

As for tips, it would depend on your experience level with programming in general and what the level of the class is. I don't want to start preaching about the proper use of curly-braces and semi-colons if you are way beyond that... haha.

Also, what kind of topics are actually being covered? Is it all command-line or GUI stuff as well? Or is it C# in ASP.NET? C# is used for multiple things in .NET and they are totally different topics. ^_^

Anyways, just let me know some more info or specifics on what you need help with.
Merlin is offline
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
 
 
Old 10-02-2008, 02:09 AM Level: 38  HP: 649 / 930
Silver's HP
EXP: 20%
Silver's XP
  #3 (permalink)
TFF Anarchist
 
Silver's Avatar
 

Join Date: Mar 2007
Location: The Free State

   Posts    2,180
        

Send a message via MSN to Silver


Code:
/* Jesus loves drunks like I like C#. Even if I do suck with it a good deal. */
using System;
namespace drunk
{
    class drunk
    {
        static void Main() 
        {
            System.Console.WriteLine("Drunker than a camel with humps full of rum.");

            // Keep the console window open in debug mode.
            System.Console.WriteLine("Press any key to sober up.");
            System.Console.ReadKey();
        }
    }
}
C#'s fun.
__________________
My Current Game Collection

I love Ann, my awesome TFF wife and real life girlfriend. Did I mention she's mindblowingly awesome?
Silver is offline
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
 
 
Old 10-02-2008, 10:31 AM Level: 7  HP: 2 / 167
chaosweapon's HP
EXP: 71%
chaosweapon's XP
  #4 (permalink)
 
chaosweapon's Avatar
 

Join Date: Feb 2006
Location: Malta, Europe

   Posts    77
        


I will start learning C from next week or the one after as part of my engineering course. It seems like it resembles Java.

Can someone please explain the static void main? I've used it a couple of times but I don't know what it means.
__________________
Webmaster of Final Fantasy Tears
Home | Forums | Topsites



“The corpse’s crimson bitter tears flow and mingle through the endless sand feeding the chaos in me and making me stronger” Gaara
chaosweapon is offline
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
 
 
Old 10-02-2008, 01:08 PM Level: 22  HP: 231 / 545
Unknown Entity's HP
EXP: 82%
Unknown Entity's XP
  #5 (permalink)
† The Fallen Angel †
 
Unknown Entity's Avatar
 

Join Date: Feb 2008
Location: London, England.

   Posts    623
        

Send a message via MSN to Unknown Entity

LOL Silver! Will that one work if I start to debug?

Quote:
Originally Posted by Tech Support View Post
I haven't touched it in a while, but I can help out if you need it. I'm quite proficient in C-based languages so ask away.

As for tips, it would depend on your experience level with programming in general and what the level of the class is. I don't want to start preaching about the proper use of curly-braces and semi-colons if you are way beyond that... haha.

Also, what kind of topics are actually being covered? Is it all command-line or GUI stuff as well? Or is it C# in ASP.NET? C# is used for multiple things in .NET and they are totally different topics. ^_^

Anyways, just let me know some more info or specifics on what you need help with.
Thank you so much! I know about the curly-braces and semi-colons lol... Its the actual maths in the processing I'm really having the trouble with. I know how to do the inputs and outputs - they are to simple to even be real - but the process... Either I'm really bad at maths, or I'm just not creative enough to work out some kinda order to my process.

The task we've been given was to make a program which converts cm into inches (1cm = 2.57inches). The thing is, I'm not sure about the symbols I should be using for this (* / - ...). Now, as I need to work this out on my own, I don't want an answer - just a little guidence to push me on the right path. Mainly because so far all I have is:

Code:
//process
            lenin = lencm;
LOL! So please, just a little nudge...

EDIT: Ok... Is this ANYWHERE near rightish?

Code:
//process
            1 = 2.57 / 2.57;
And good luck chaosweapon! Haha, we'll be kinda in the same boat, but I think you may have better luck than me if you've worked with Java...

EDIT: Silver, that had more build errors than my first program lol!
__________________
"I think I want to be forgiven... More than anything."
My dearest TFF boyfriend, Martin... Much love... <3
"Are sins ever forgiven?"

My GREAT TFF Family, and some good quotes!:


All my banners are now done by me! Soon, I will be great! Muwahahahaha... ha... eck! *coughs* ...ha!

(If you'd like to join my family, send me a PM! You are more than welcome!)

My Fab Mum, Athna Loveil; My Ace Pilot FF Ace Cid; My car mad, Manchester United FC and Rochdale Fan brother The Migthy Dale; My loopy sibling who loves sugar, Crazy Chocobo; My super cool nephew Rasler+; My In Heaven with FFVII brother, Secret Weapon; My hilarious 'friend', loner-kid; My Old Skooler cousin, Silver; My totally odd, but totally cool brother, Raider; My self absorbed brother, Morik the Rogue; My terror brother, Rocky; My totally awesome sister, winterborn86; My Flying Cookie Monster Nepew, Mr Spike; Johto remake hunter aunt, Refieth; My Mastermind of FF Trivia half-brother, Phantom; My omonus and mysterious sister, Neggropino; My Metal and Tattoo loving sister, Kat; My comically egotistical uncle, Sharzademar; My lovely book writting sister, Dizz; My FF obsessed sister, brnthsdiscout; My creepy uncle who you bet could be a rapist, Jesus Christ; My sci-fi and fantasy-addicted uncle, Dragon_Jiriki; My potatoe munching owner, Bleachfangirl; My "The God Father" brother, Dark Squall


You can see everything if you take the time to look.

What we think is real is only as real as what our minds make it.


Quotes from you guys, my mates and some random ones to have a giggle at.:

Quote:
Originally Posted by Bleachfangirl
I'm none too scary really. Just somewhat violent... hehe...
Quote:
Originally Posted by Martin
My name is Martin J. Cullen. And I approve of these awards. And I deserve 69.3 no... 69.4% of them.
Quote:
Originally Posted by Dark Squall
F**K, I lost my sig!
Quote:
Originally Posted by Sylvie (Vaperida)
Hah. You gave Mikey moodswings. He's schitzophrenic like Harry Potter!
Quote:
Originally Posted by Cathy L. Poulin
"I believe most at-home accidents happen in the bathroom because our Guardian Angels give us our privacy".

Biggest fan of Peanut Butter created by The Xeim and Halie Peanut Butter Corporation ^_^


Last edited by Unknown Entity; 10-02-2008 at 01:19 PM.
Unknown Entity is offline
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
 
 
Old 10-02-2008, 06:06 PM Level: 38  HP: 649 / 930
Silver's HP
EXP: 20%
Silver's XP
  #6 (permalink)
TFF Anarchist
 
Silver's Avatar
 

Join Date: Mar 2007
Location: The Free State

   Posts    2,180
        

Send a message via MSN to Silver


Quote:
Originally Posted by Unknown Entity View Post
EDIT: Silver, that had more build errors than my first program lol!
It was a semi-drunk joke.
Considering I wrote it in a couple minutes as a joke I'd be surprised if it did really work.

I thought it was a beautiful artistic expression.
__________________
My Current Game Collection

I love Ann, my awesome TFF wife and real life girlfriend. Did I mention she's mindblowingly awesome?
Silver is offline
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
 
 
Old 10-02-2008, 08:54 PM Level: 65  HP: 1171 / 1622
Merlin's HP
EXP: 91%
Merlin's XP
  #7 (permalink)
Magically Delicous
 
Merlin's Avatar
 

Join Date: Jan 2001
Location: Quel'thalas

   Posts    10,447
        
Romandan Pistol

Send a message via AIM to Merlin


Quote:
Originally Posted by chaosweapon View Post
ICan someone please explain the static void main? I've used it a couple of times but I don't know what it means.
A static method, field, property, or event is callable on a class even when no instance of the class has been created. If any instances of the class are created, they cannot be used to access the static member. Only one copy of static fields and events exists, and static methods and properties can only access static fields and static events. Static members are often used to represent data or calculations that do not change in response to object state; for instance, a math library might contain static methods for calculating sine and cosine.

void simply means that the method returns nothing. You can have an int method that would return an int, for instance. Void methods do not return anything at all.

So, what does this all mean? The main method is static for multiple reasons. The easy explaination is because it's the method called at the start of the program before any others that you create. I could go into a lengthy discussion explaining the difference between static and instance members, but that is probably beyond the scope of where you are at this moment. Basically, if you make a method static, it's the same every time you call it. For a variable, if it is static, it is the same no matter how many copies of that class you make. If you change that variable in one of the instances, it changes in all of them.


Quote:
Originally Posted by Unknown Entity View Post
The task we've been given was to make a program which converts cm into inches (1cm = 2.57inches). The thing is, I'm not sure about the symbols I should be using for this (* / - ...). Now, as I need to work this out on my own, I don't want an answer - just a little guidence to push me on the right path. Mainly because so far all I have is:
Well there's multiple ways to do it really. You can have a variable that has the upconversion rate in it or write a method to do it.

Here's a simple method that would do it:
Code:
    public static double CentimetersToInches(string input)
    {
        // Convert argument to double for calculations.
        double c = System.Double.Parse(input);

        // Convert Centimeters to Inches
        double i = (c * 2.57);

        return i;
    }
OR:
Outside of your main method (inside the main class):
Code:
static final double CENTIMETERSTOINCHES = 2.57;
then just take your input and multiply:
Code:
double i = input * CENTIMETERSTOINCHES;

I think your main hangup is you don't seem to know how to use variables yet. All your calculations are typically done with variables. Well you could technically do the whole program with none, but that'd be a mess and nobody would want to debug it:
Code:
System.Console.Writeln("Input the number of centimeters:");
System.Console.Writeln("Centemeters to inches is {0}", (System.Double.Parse(System.Console.ReadLine())* 2.57);
Yeah, I'd bust you upside the head for writing something like that. Variables are what you use to store values and information. Use them!

Double is your standard floating-point number variable. If you need to store a number with decimals, use double. Int is used for your typical non-floating-point numbers... ie: it does not store decimals. Keep that in mind... because it WILL screw up your calculations if you don't.

Code:
System.Console.Writeln("5 / 2.2 is: " + ((int)5 / (int)2.2));
//5 / 2 is: 2
Stuff like that will screw you over every time. Don't depend on the compiler to tell you. Many cases it will flag it as "loss of precison". If it does, you are trying to dump a bigger value into the wrong sized container... like a golf ball through a garden hose. It doesn't fit. You can make it fit, but it's not going to be pretty.
Merlin is offline
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
 
Sponsored Links
 
Old 10-02-2008, 09:12 PM Level: 12  HP: 20 / 291
VidenTheColdOne's HP
EXP: 65%
VidenTheColdOne's XP
  #8 (permalink)
 
VidenTheColdOne's Avatar
 

Join Date: Jun 2007
Location: U.S.A.

   Posts    185
        


Oh god. I did visual basic in high school, and it was A LOT of fun, but it was quite difficult. I poked around with C++ and Java, but it was waaaay over my head. I wish the best of luck to you.
__________________


98% of teens have tried smoking pot and drinking. If you're one of the 2% who hasn't, copy this and put it in your signature.
VidenTheColdOne is offline
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
 
 
Old 10-03-2008, 10:23 AM Level: 65  HP: 1171 / 1622
Merlin's HP
EXP: 91%
Merlin's XP
  #9 (permalink)
Magically Delicous
 
Merlin's Avatar
 

Join Date: Jan 2001
Location: Quel'thalas

   Posts    10,447
        
Romandan Pistol

Send a message via AIM to Merlin


VB is the simplest language you can learn, besides BASIC. It really should only be taught to non-majors, IMHO. I always get a good laugh when people start bragging that they are certified in Visual BASIC or swear by that language. They honestly think it's a hardcore programming language and that they are doing something elite. Um... no. It has the word "basic" in it for a reason.

But enough of my soap box, if you need programming help I can do that. I won't post the entire code for completing something, but I will give you the necessary tools to help you learn and figure problems out. Most of the time you spend programming is debugging. You've got to learn from the start how to do it or else you'll never succeed.
Merlin is offline
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
 
 
Old 10-09-2008, 01:44 PM Level: 22  HP: 231 / 545
Unknown Entity's HP
EXP: 82%
Unknown Entity's XP
  #10 (permalink)
† The Fallen Angel †
 
Unknown Entity's Avatar
 

Join Date: Feb 2008
Location: London, England.

   Posts    623
        

Send a message via MSN to Unknown Entity

Thanks for all your help Tech Support! I shoulda replied earlier, but I was scared that I'd never work it out...

But I worked out how to do it! O_O

I wrote a program on how to divide any number by 12!

Code:
            int stnumber;
            int ndnumber;

            //input
            Console.WriteLine("Enter number to be divided >");
            stnumber = int.Parse(Console.ReadLine());

            //process

            ndnumber = stnumber / 12;

            //output
            Console.WriteLine("Answer is {0}:", ndnumber);
            Console.ReadLine();
__________________
"I think I want to be forgiven... More than anything."
My dearest TFF boyfriend, Martin... Much love... <3
"Are sins ever forgiven?"

My GREAT TFF Family, and some good quotes!:


All my banners are now done by me! Soon, I will be great! Muwahahahaha... ha... eck! *coughs* ...ha!

(If you'd like to join my family, send me a PM! You are more than welcome!)

My Fab Mum, Athna Loveil; My Ace Pilot FF Ace Cid; My car mad, Manchester United FC and Rochdale Fan brother The Migthy Dale; My loopy sibling who loves sugar, Crazy Chocobo; My super cool nephew Rasler+; My In Heaven with FFVII brother, Secret Weapon; My hilarious 'friend', loner-kid; My Old Skooler cousin, Silver; My totally odd, but totally cool brother, Raider; My self absorbed brother, Morik the Rogue; My terror brother, Rocky; My totally awesome sister, winterborn86; My Flying Cookie Monster Nepew, Mr Spike; Johto remake hunter aunt, Refieth; My Mastermind of FF Trivia half-brother, Phantom; My omonus and mysterious sister, Neggropino; My Metal and Tattoo loving sister, Kat; My comically egotistical uncle, Sharzademar; My lovely book writting sister, Dizz; My FF obsessed sister, brnthsdiscout; My creepy uncle who you bet could be a rapist, Jesus Christ; My sci-fi and fantasy-addicted uncle, Dragon_Jiriki; My potatoe munching owner, Bleachfangirl; My "The God Father" brother, Dark Squall


You can see everything if you take the time to look.

What we think is real is only as real as what our minds make it.


Quotes from you guys, my mates and some random ones to have a giggle at.:

Quote:
Originally Posted by Bleachfangirl
I'm none too scary really. Just somewhat violent... hehe...
Quote:
Originally Posted by Martin
My name is Martin J. Cullen. And I approve of these awards. And I deserve 69.3 no... 69.4% of them.
Quote:
Originally Posted by Dark Squall
F**K, I lost my sig!
Quote:
Originally Posted by Sylvie (Vaperida)
Hah. You gave Mikey moodswings. He's schitzophrenic like Harry Potter!
Quote:
Originally Posted by Cathy L. Poulin
"I believe most at-home accidents happen in the bathroom because our Guardian Angels give us our privacy".

Biggest fan of Peanut Butter created by The Xeim and Halie Peanut Butter Corporation ^_^


Last edited by Unknown Entity; 10-09-2008 at 01:59 PM.
Unknown Entity is offline
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
 
 
Old 10-10-2008, 10:22 PM Level: 65  HP: 1171 / 1622
Merlin's HP
EXP: 91%
Merlin's XP
  #11 (permalink)
Magically Delicous
 
Merlin's Avatar
 

Join Date: Jan 2001
Location: Quel'thalas

   Posts    10,447
        
Romandan Pistol

Send a message via AIM to Merlin


>_>

5/12 = 0.4166666666666_
But your prog will give : 5/12 = 0.

If you're only allowed to use integers that is fine, but you'll always have truncation(the decimals are chopped off), which means your results will only be accurate if the entered number is evenly divisible by 12. Try lots of numbers and see.

Always use double if your result has the possibility of having decimals.

In other news, while you can name variables whatever the heck you want, it's always a good idea for clarity sake to name them something easily understandable/readable by anyone like numerator, total, inNum, outNum, etc. It's just a recommendation, but teachers will love you and when you have to check your code for errors, it makes it so much easier. Trust me, when you get to a lot of lines of code, you won't remember what the heck ndnumber was for. ^_^

edit: Oh do remember my point from my previous post... if you make 'ndnumber' into a double, it will still be wrong. An integer divided by an integer placed in a double is still an integer...then it adds .0 after it. ie:
ndnumber = 0.0

You can easily get around that though. just add a .0 to 12.

Code:
            int stnumber;
            double ndnumber;

            //input
            Console.WriteLine("Enter number to be divided >");
            stnumber = int.Parse(Console.ReadLine());

            //process

            ndnumber = stnumber / 12.0;

            //output
            Console.WriteLine("Answer is {0}:", ndnumber);
            Console.ReadLine();
But like I said, if your teacher wants only integers, then your code is fine. I know a lot of teachers like forcing students to use rudementary variable types first to "prove" what I have already explained to you... that integers fark up decimal calculations. Guess what you already learned it from me!
Merlin is offline
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
 
 
Old 10-17-2008, 03:19 PM Level: 22  HP: 231 / 545