Jump to content
  • Advertisement
Sign in to follow this  
Calcious

Console.writeline Not Printing Out Expression. C#

This topic is 807 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement

No errors at all :|

 

Here's the full code..

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Variables_and_Operators
{
    class Program
    {
        static void Main(string[] args)
        {
            //do not write decimals in byte or int. 20.0 is different from 20 in C#. Lol.
            byte userage = 20;
            int NumberOfEmployees = 210;
            //you can hold integral numbers with double, float and decimal despite them be using for decimals. 
            double hip = 15;
            float slip = 30;
            decimal grip = 45;
            //you need to add f in the float variable after the number to turn it into a float and for the compiler to recognize it exactly as a float. You need to add m to turn decimal into decimal.
            double strom = 15.322;
            float group = 15.753f;
            decimal shopper = 99.12345m;
            //this is a char data type, when initializing char, use ' instead  of ".
            char grade = 'A';
            //this is a bool
            bool promote = true;
            //you can store multiple variable in the same line as long as they are the same type.
            byte bob = 50, stanley = 90;
            //you can initialize a variable on a different statement.
            byte year;
            year = 157;
            int x = 1, y = 2;
            x = y + x; // x <- y... Aka when x = y, the value of y goes to x. y stays the same, x changes to y.
            y = x; // y <- x... y still stays the same since x is 2 and y was already 2.
            Console.WriteLine(x);
            Console.WriteLine(y);
            Console.Read();
            //as long as there is one non integer number in the equation, you will get a non integer value other wise it will be truncated.
            Console.WriteLine(7 / 2);
            Console.WriteLine(7.0 / 2);
            Console.WriteLine(7 / 2.0);
            Console.WriteLine(7.0 / 2.0);
            x++; //increases a value by 1
            x--; //decreases a value by 1
            //++ can be placed before a variable or after it, it affects the sequence in which tasks are performed.
            int counter = 1;
            Console.WriteLine(counter++); //prints the original value of counter and then it increments the value. As in it will print the original value but not the value++.
            Console.WriteLine(++counter); //increments the value then prints the new value.
            //converts 20.9 into an integer.
            x = (int)20.9;
            //Another way to declare a float or decimal without f or m. Remember that all numbers with decimals are treated as double first.
            float num1 = (float)20.999999999;
            decimal num2 = (decimal)20.53;


        }
    }
}

It's messy but ehhhhhhhhhhhhhhhhhh.

Edited by Calcious

Share this post


Link to post
Share on other sites

No errors at all :|

 

Here's the full code..

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Variables_and_Operators
{
    class Program
    {
        static void Main(string[] args)
        {
            //do not write decimals in byte or int. 20.0 is different from 20 in C#. Lol.
            byte userage = 20;
            int NumberOfEmployees = 210;
            //you can hold integral numbers with double, float and decimal despite them be using for decimals. 
            double hip = 15;
            float slip = 30;
            decimal grip = 45;
            //you need to add f in the float variable after the number to turn it into a float and for the compiler to recognize it exactly as a float. You need to add m to turn decimal into decimal.
            double strom = 15.322;
            float group = 15.753f;
            decimal shopper = 99.12345m;
            //this is a char data type, when initializing char, use ' instead  of ".
            char grade = 'A';
            //this is a bool
            bool promote = true;
            //you can store multiple variable in the same line as long as they are the same type.
            byte bob = 50, stanley = 90;
            //you can initialize a variable on a different statement.
            byte year;
            year = 157;
            int x = 1, y = 2;
            x = y + x; // x <- y... Aka when x = y, the value of y goes to x. y stays the same, x changes to y.
            y = x; // y <- x... y still stays the same since x is 2 and y was already 2.
            Console.WriteLine(x);
            Console.WriteLine(y);
            Console.Read();
            //as long as there is one non integer number in the equation, you will get a non integer value other wise it will be truncated.
            Console.WriteLine(7 / 2);
            Console.WriteLine(7.0 / 2);
            Console.WriteLine(7 / 2.0);
            Console.WriteLine(7.0 / 2.0);
            x++; //increases a value by 1
            x--; //decreases a value by 1
            //++ can be placed before a variable or after it, it affects the sequence in which tasks are performed.
            int counter = 1;
            Console.WriteLine(counter++); //prints the original value of counter and then it increments the value. As in it will print the original value but not the value++.
            Console.WriteLine(++counter); //increments the value then prints the new value.
            //converts 20.9 into an integer.
            x = (int)20.9;
            //Another way to declare a float or decimal without f or m. Remember that all numbers are treated as double first.
            float num1 = (float)20.999999999;
            decimal num2 = (decimal)20.53;


        }
    }
}

It's messy but ehhhhhhhhhhhhhhhhhh.

 

That's okay.

 

Comparing what you put in for all your writelines and what fastcall put in in there's it seems to be that you are missing System. before all of them.  If you aren't getting any print outs try reformatting them to System.Console.WriteLine and see if that works.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!