I mentioned in a previous thread Iv'e just started C# programming, for some reason, a piece of code I'm using isn't working, but it looks correct to me, any insight would be grateful, using Visual Studios 2010, the code is;
Firstly, it had to be typed with the > first, as i realized the other way around assigns 'u' and it's already declared, second, that one space between the '>' and the '='' presents errors.
That one space between the operators screws the code, i didn't know that as i assumed like C++ it classes it as just white space, apparently not.
Thank you so much, that has been annoying me and pissing me off for about an hour, just trying to decipher what the hell was wrong.
Yeah, that one space caused an ungodly amount of confusion and error that i just couldn't get passed, now my code goes off without problem, I'll paste the code so you can see what I mean.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Alcohol_Male_Female
{
class Program
{
static void Main(string[] args)
{
string input;
int u;
int dayCount = 0;
int total;
string inNumber;
do
{
Console.Write("How many units of alcohol do you consume daily? : ");
inNumber = Console.ReadLine();
u = Convert.ToInt32(inNumber);
dayCount++;
if (u >= 21)
{
Console.Write("Male - exceeded weekly units\n");
}
Signature/Avatar nuking: none (can be changed in your profile)
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum