so,I saw this code somewhere in a tutorial on youtube , and I tryed to run it,but it didn't work.
using System;
using System.Collections.Generic;
using System.Lynq;
using System.Text;
namespace Math
{
class Program
{
static void Main(string[] args)
{
int num1 = 8;
int num2 = 10;
int ans : num1 + num2;
num1 = 8 + 12;
Console.WriteLine(ans);
Console.WriteLine(num1);
Console.ReadLine();
}
}
}
I am noob at c++ , but shouldn't any program start with include <iostream> ?
I will appreciate any help,thanks.
i m a beginner too but in this output there is no need #include<iostream> iostream is necessery when u use cin ,cout ,clog ,cerr codes.
and i guess this is so much for a beginner u should't start with these codes u should learn hello world then basic math for example hello world is
#include<iostream>
//if u want to use getch(); u must add #include<conio.h>
// "//" use for make a line comment
/*use for comments
between */
using std::cout; /*cout must use std::cout everytime but if u write this code u don't have to write "std::cout"*/
main()
{
cout<<"Hello World"; // make program print Hello World
return 0; // ends the program And u can use getch(); to see what printed
}
but if u say i already know it u should examine many examples
And i can be mistaken anyway