posted on 17 Aug 2012 00:13 by inet03 in Personal
#include <stdio.h>
#include <iostream>
#include <conio.h>
float Addition(float N1, float N2) { return N1 + N2; }
void Cal(){
int Cmd;
float N1, N2;
float (*Rs)(float N1,float N2) = NULL;
std::cout << "Menu \n"
<< "[1] Addition \n"
<< "[0] Exit \n";
scanf("%i", &Cmd);
system("cls"); //clrscr();
switch (Cmd)
{
case 1:
Rs = Addition;
break;
default:
return;
break;
}
std::cout << "Enter first value \n";
scanf("%f", &N1);
std::cout << "Enter second value \n";
scanf("%f", &N2);
std::cout << "Result = " << Rs(N1, N2) << " \n \n";
Cal();
}
int main(){
Cal();
}
posted on 16 Aug 2012 13:29 by inet03 in Personal
บันทึกการศึกษา C++ : 001
#include <stdio.h>
#include <iostream>
#include <conio.h>
int *Sub(){
int Me[] = {9,10,11,12};
return Me; // return reference pointer
}
int MyVal = 99;
int main(){
unsigned char Ex[11];
scanf("%s", Ex); // Input ค่า
printf("Input : %s \n",Ex); //ปริ๊นค่าออก
int *Ext = Sub(); //รับค่า Array โดย Reference Pointer
printf("Input : %d \n",Ext[sizeof Ext - 1]); //sizeof ตรวจนับขนาดของอาเรย์
std::cout << "Output : " << sizeof Ext << "\n";
int MyVal;
MyVal = 88;
std::cout << "In : " << MyVal << "\n";
std::cout << "Out : " << ::MyVal << "\n";
scanf("%s", Ex);
return 0;
}
ผลลัพย์
Richter
Input : Richter
Input : 12
Output : 4
In : 88
Out : 99
posted on 30 Jun 2012 23:13 by inet03 in PC-Talk
Start -> Search -> Environment
%ALLUSERSPROFILE%
C:\ProgramData
%APPDATA%
C:\Users\(username}\AppData\Roaming
%CommonProgramFiles%
C:\Program Files\Common Files
%CommonProgramFiles(x86)%
Only available in 64-bit (x64) OS, and point to Common Files directory in 32-bit Program Files.
%COMPUTERNAME%
{computername}
%COMSPEC%
C:\Windows\System32\cmd.exe
%HOMEDRIVE%
C:
%HOMEPATH%
\Users\{username}
%LOCALAPPDATA%
C:\Users\{username}\AppData\Local
%PATH%
Varies. Includes C:\Windows\System32\;C:\Windows\;C:\Windows\System32\Wbem
%PATHEXT%
.COM; .EXE; .BAT; .CMD; .VBS; .VBE; .JS ; .WSF; .WSH; .MSC
%ProgramData%
C:\ProgramData
%PROGRAMFILES%
Directory containing program files, usually C:\Program Files
%ProgramFiles(x86)%
In 64-bit systems, directory containing 32-bit programs. Usually C:\Program Files (x86)
%PROMPT% Code for current command prompt format. Code is usually $P$G
%Public% C:\Users\Public
%SYSTEMDRIVE%
The drive containing the Windows root directory, usually C:
%SYSTEMROOT%
The Windows root directory, usually C:\Windows
%TEMP% and %TMP%
C:\Users\{Username}\AppData\Local\Temp
%USERNAME%
{username}
%USERPROFILE%
C:\Users\{username}
%WINDIR%
C:\Windows