People don't read stickys (judging by the amount of rule-breakers this forum has) so it's better to just leave it amongst normal threads.
No, people don't read rules cause they are boring, useless and most likely a freakin wall of text. And the egies don't even understand what it says anyways.
@ Above: I agree with you. In all honesty, nobody reads the rules until they start getting bans or warnings.
Well it's no problem if this isn't stickied. My other one containing videos is stickied, and I added a link noting that it was superseded by this one.
Anyhow, I'll try to get up a lesson on structures (I'm going to break this down into two parts). If anyone cares why I'm breaking it down into two parts, in one, I'm going to talk about using structures the way I do, and in the other, I'm going to talk about general-case scenarios as to how they can be used (but I wouldn't use them as such).
ty bud, e*pvp should thank you 4ever for your great releases and your willing to help this forum. ty again! im learning your guide right now and you know what? you explained this shit very well so everyone can learn it thanks again. i would rape the thanks button if i could thank you more than one time
Later edit: I think is a problem at lesson five - bool values
Code:
if (condition)
{
// code to execute if condition is true
}
else if (condition2)
{
// code to execute if condition is false
// and condition2 is true
}
else
{
// code to execute if condition is false
// and condition2 is false
}
i think you need to add the "if" for the 3rd condition also (where the code execute if the both conditions are false). ifi let it like it is right now without the "if" at the 3rd statement, error pop up but if i add "if" everything works fine. here's the code
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Tell me how much money you have in your pockets");
double amount = double.Parse(Console.ReadLine());
if (amount > 2000.00)
{
Console.WriteLine("You are rich");
Console.ReadLine();
}
else if (amount == 2000.00)
{
Console.WriteLine("You are fine");
Console.ReadLine();
}
else if (amount < 2000.00)
{
Console.WriteLine("You are poor");
Console.ReadLine();
}
}
}
}
[code]using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Tell me how much money you have in your pockets");
double amount = double.Parse(Console.ReadLine());
if (amount > 2000.00)
{
Console.WriteLine("You are rich");
Console.ReadLine();
}
else if (amount == 2000.00)
{
Console.WriteLine("You are fine");
Console.ReadLine();
}
else if (amount < 2000.00)
{
Console.WriteLine("You are poor");
Console.ReadLine();
}
}
}
}
You can use ternary operations for calls like that. Here's an example:
Code:
static void Main(string[] args)
{
Console.WriteLine("Please insert how much money you have in your pockets");
Console.Write("Amount: ");
double amount = double.Parse(Console.ReadLine());
Console.WriteLine(amount > 2000 ? "You are rich!" : "You are poor!");
}
Thats really awesome Emme but i just started with C# and i dont know very much about, just following Hybrid's guides and trying to understand them (now i'm stuck at Lesson 6 - While Loops). I still have a question. My ****** code it's actually working fine and there's not problem writing the code like mine or like you isnt it? I know your code it's smaller just 4 codelines but doesnt really matter if i do in my way. What i mean it's correct what i done or not ?
Thats really awesome Emme but i just started with C# and i dont know very much about, just following Hybrid's guides and trying to understand them (now i'm stuck at Lesson 6 - While Loops). I still have a question. My shitty code it's actually working fine and there's not problem writing the code like mine or like you isnt it? I know your code it's smaller just 4 codelines but doesnt really matter if i do in my way. What i mean it's correct what i done or not ?
I see.
The way you're doing it is like
Code:
if (amount > 2000.00)
{
Console.WriteLine("You are rich");
Console.ReadLine();
}
else if (amount == 2000.00)
{
Console.WriteLine("You are fine");
Console.ReadLine();
}
else if (amount < 2000.00)
{
Console.WriteLine("You are poor");
Console.ReadLine();
}
but if you want it done that way, you should do:
Code:
static void Main(string[] args)
{
Console.WriteLine("Enter the amount of money in your pockets");
Console.Write("Amount: ");
double amount = double.Parse(Console.ReadLine());
if(amount > 2000) // Checks if amount is 2001 or above
Console.WriteLine("You are rich");
else if(amount < 2000) // Checks if amount is 1999 or under
Console.WriteLine("You are poor");
else //Else if amount isn't under 1999 or over 2001, it is 2000.
Console.WriteLine("You are fine");
Console.ReadLine();
}
ty bud, e*pvp should thank you 4ever for your great releases and your willing to help this forum. ty again! im learning your guide right now and you know what? you explained this shit very well so everyone can learn it thanks again. i would rape the thanks button if i could thank you more than one time
Later edit: I think is a problem at lesson five - bool values
Code:
if (condition)
{
// code to execute if condition is true
}
else if (condition2)
{
// code to execute if condition is false
// and condition2 is true
}
else
{
// code to execute if condition is false
// and condition2 is false
}
i think you need to add the "if" for the 3rd condition also (where the code execute if the both conditions are false). ifi let it like it is right now without the "if" at the 3rd statement, error pop up but if i add "if" everything works fine. here's the code
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Tell me how much money you have in your pockets");
double amount = double.Parse(Console.ReadLine());
if (amount > 2000.00)
{
Console.WriteLine("You are rich");
Console.ReadLine();
}
else if (amount == 2000.00)
{
Console.WriteLine("You are fine");
Console.ReadLine();
}
else if (amount < 2000.00)
{
Console.WriteLine("You are poor");
Console.ReadLine();
}
}
}
}
tell me if i am wrong!!!
What you did was absolutely correct. Let's take a look at what you said. You wanted to know why this was wrong:
Code:
Console.WriteLine("Tell me how much money you have in your pockets");
double amount = double.Parse(Console.ReadLine());
if (amount > 2000.00)
{
Console.WriteLine("You are rich");
Console.ReadLine();
}
else if (amount == 2000.00)
{
Console.WriteLine("You are fine");
Console.ReadLine();
}
else (amount < 2000.00)
{
Console.WriteLine("You are poor");
Console.ReadLine();
}
The reason it is wrong is because, is because the "else" case should only be used when all above conditions are false. What you were trying to do, was specify another condition to check: (amount < 2000.00), so for this we would use else if as you had done .
Something to think about though is
Code:
Console.WriteLine("Tell me how much money you have in your pockets");
double amount = double.Parse(Console.ReadLine());
if (amount > 2000.00)
{
Console.WriteLine("You are rich");
Console.ReadLine();
}
else if (amount == 2000.00)
{
Console.WriteLine("You are fine");
Console.ReadLine();
}
else
{
Console.WriteLine("You are poor");
Console.ReadLine();
}
Would work perfectly fine! Because, above your final else statement, we check if amount > 2000.00 and amount == 2000.00, and if both of these are false -- then amount < 2000.00must be true!
Quote:
Originally Posted by Korvacs
I was going to sticky this once Unit 2/3 had been completed so that there was alot of content available.
Thanks a lot Jack for the support. Really appreciated.
Quote:
Originally Posted by EmmeTheCoder
You can use ternary operations for calls like that. Here's an example:
Code:
static void Main(string[] args)
{
Console.WriteLine("Please insert how much money you have in your pockets");
Console.Write("Amount: ");
double amount = double.Parse(Console.ReadLine());
Console.WriteLine(amount > 2000 ? "You are rich!" : "You are poor!");
}
While using the ternary operator is simpler, it is not easier for early programmers to understand. The early-on unit-one series' goal isn't to create good programming habits, but to familiarize new programmers with the language.
Quote:
Originally Posted by co_george
Thats really awesome Emme but i just started with C# and i dont know very much about, just following Hybrid's guides and trying to understand them (now i'm stuck at Lesson 6 - While Loops). I still have a question. My shitty code it's actually working fine and there's not problem writing the code like mine or like you isnt it? I know your code it's smaller just 4 codelines but doesnt really matter if i do in my way. What i mean it's correct what i done or not ?
You're absolutely right. At this point in time, it doesn't matter how you do it as long as you understand what you are doing!.
Directed more at Emme, not George:
However, it should be noted, your code and Emme's code carries a significant difference. Your code checks for 3 things equality, greater than, & lesser than, using the ternary operator as Emme has done is checking for greater than and if not, lesser than or equal to. So NO. One ternary operation in this case is not applicable and wrong. You can tell this is wrong because Emme's code will show two outputs on the console (poor, or rich), while yours shows three (poor, rich and fine).
Edit:
Added (Unit Two) Lesson Three - Enumerations.
Also, and edit to my last remarks in this post.
Here's a pretty good list you could use to exam stages on the road of learning programming. Don't use it to see yourself as a bad programmer as you might not qualify on all the points, but use it now and then to see that you're progressing.
Here's a pretty good list you could use to exam stages on the road of learning programming. Don't use it to see yourself as a bad programmer as you might not qualify on all the points, but use it now and then to see that you're progressing.
Skimming over that link, it seems more targeted at C/C++ programmers rather than higher-level language programmers (i.e. Java, C#, et cetra).
Holy ****. How are you still here? I used this tutorial like a year ago. (video)
Due to be quitting retail CO, a lot of spare time has opended up for me (and not to mention, now I'm on winter breaK). So, I've got a lot of time, with a whole lot of nothing tot do. So, I ifgure, might as well do something productive, eh?
Edit:
Added Lesson Four - Bit Operations and Enumerations (II).
wonder if you could, or if your intending to anyway, talk about stackalloc, and using out & ref. <--- tis completely confused me, learning vb as my first language :S
these bitwise operations finally put my knowledge of truth tables and logic gates to some use, haha.
wonder if you could, or if your intending to anyway, talk about stackalloc, and using out & ref. <--- tis completely confused me, learning vb as my first language :S
No problem. I can cover ref/out in the next lesson -- but, I'm not going to cover stackalloc until "Welcome to the darkside".
Programming For Idiots (Tutorial) - In C# 05/25/2013 - CO2 Programming - 188 Replies This tutorial has been superseded by: http://www.elitepvpers.com/forum/co2-programming/88 5939-programming-idiots-c-take-2-a.html
Well for the next week (or so) due to being bored, I've started a video-tutorial called C# Programming for Idiots and yeah, by the end of it I'll demonstrate how to make a conquer server (patch 5016 and before) without the need of mysql, or anything like that; all you need is the Visual C# compiler, and WinRAR (To extract the videos).
Visual C# Compiler:...
Programming for Idiots (Tutorial) C++ 06/11/2012 - CO2 Programming - 20 Replies Yeah, so in my relation to my C# one (http://www.elitepvpers.com/forum/co2-guides-templa tes/148675-programming-idiots-tutorial-c.html), which wasn't the best I felt I'll *try* make for it with this one. I've also got some spare time in between school, from when exams start, and a new Warlords server comes out... so yeah.
Right, so before I post any links to the videos I'd like to point out, so I don't get bitched at by people saying, "this isn't real C++", most of the things I do will be...