비주얼 스튜디오 버전 커뮤니티 버전(Visual Studio Community) 프로페셔널 버전(Visual Studio Professional) 엔터프라이즈 버전(Visual Studio Enterprise)
#include <iostream>과 std <iostream>이 통째로 std 이름 공간 내에 선언 � <iostream> 헤더 파일을 사용하려면 다음 코드 필요 #include <iostream> using namespace std;
bool 타입 bool형의 변수는 참(true) 또는 거짓(false)만을 가질 수 있 다. #include <iostream> using namespace std; int main() { bool b; b = true; return 0; } // 지금부터 이름공간으로 std를 사용한다.
문자열: C++ string 클래스 #include <iostream> #include <string> // string 사용시 포함되어야 함 using namespace std; int main() { string s 1 = "Good"; string s 2 = "Morning"; string s 3 = s 1 + " " + s 2 + "!"; cout << s 3 << endl; return 0; }
문자열: C++ string 클래스 문자열 입력 string name; cout << “Enter your name: ”; cin >>name; cout <<name <<“are welcomed”<<endl;
알고리즘 기술 언어: SPARKS 배정문 변수 <- 식 while cond do S repeat 조건문 if (조건식) then S 1 else S 2 endif Case 문 case : cond 1: S 1 : cond 2: S 2 … : condn: Sn : else: Sn+1 endcase For 문 for variable <- start to finish by increment do S repeat if (조건 식) then S endif While 문 Do-while 문 loop S until cond repeat
알고리즘 기술 언어: SPARKS procedure MAX(a, n) global real xmax parameters integer n; real a(1: n) local integer i xmax <- a(1) for i <- 2 to n do if a(i) > xmax then xmax <- a(i) endif repeat end MAX start integer xmax call read. Data(a, n) call MAX(a, n) print(xmax) end