c++ to c# |
C, C++ and C# Basic
Alternative keywords
C and C++
|
C#
|
Void main (void)
|
Static void Main(string [] args)
|
Printf ()
|
Console .Write()
|
Printf(“\n”)
|
Console. WriteLine()
|
Scanf
|
Console. ReadLine
|
%d, %f, %c
|
{0}
|
Getch()
|
Console .Readkey ()/ Console. Read Line()
|
Variable ++ = i++ == i= i+1
|
Variable +=1 ==
i+=1
|
Function
|
Object
|
float
|
double
|
Float + integers
|
decimal
|
Alternative syntax
Function
|
C and C++
|
C#
|
int a, num, sum;
float a, num1, b:
char a, b, c, d:
|
int a, num1, sum;
float a, num1, b:
char a, b, c, d:
|
|
Print
message
|
printf(“message”);
|
Console. Write(“message”);
|
Print
values
|
printf(“%d / %f / %c”, variable/expression);
|
Console. Write(“{0}”, variable/exp)
|
Take input
|
scanf(“%d / %f / %c”,& num);
|
num=int.Parse(Console.Readline());
|
Function/object
Definition
|
returntype function name(input variable)
{
}
|
Public Class object name
{
Public returntype
name (input parameter)
{
}
}
|
Function/object
Calling
|
returnvariable=function name(input parameters);
|
Obj. objname(input parameters);
|
for(initialize; condition;
inc/dec )
{
}
|
for(initialize; condition;
inc/dec )
{
}
|
|
if(condition)
{
}
else
|
if(condition)
{
}
else
|
|
Stop screen
|
getch();
|
Console. ReadKey();
|
0 comments:
Post a Comment
Please do not enter any spam link in the comment box