Notice
Recent Posts
Recent Comments
Link
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Archives
Today
Total
관리 메뉴

브래의 슬기로운 코딩 생활

C++프로그래밍 1주차 과제 본문

1-2/C++프로그래밍

C++프로그래밍 1주차 과제

김브래 2022. 9. 4. 17:37

수업 시간에 실습한 소스 코드

 

#include <iostream>

using namespace std;

int main()

{

cout<<"Hello World";

return 0;

}

 

 

 

#include <iostream>

#include <stdio.h>

using namespace std;

 

int main()

{

cout << "Hello Worl1d\n";

printf("Hello");

 

return 0;

}

 

public class HelloWorld

{public static void main(String[] args)

{System.out.println("Hello, World!");

}} // JAVA (.java)

 

 

#include <iostream>

int main()

{std::cout<<"Hello, World!";

} //C++(.cpp)

 

 

class HelloWorldApp

{public static void Main()

{System.Console.WriteLine("Hello, World!");

}} // C# (.cs)

 

#include <stdio.h> // 전처리기, 5

#define SIZE 4 // 전처리기, 5

typedef struct { // 구조체, 12

char name[10];

double w;

}WEIGHT;

void swap(WEIGHT*, WEIGHT*); // 함수 선언, 8

int main(void)

{

WEIGHT man[SIZE] = { {"한개발",57.5}, // 배열, 10

{"엄청군",125.6},

{"갈비양",35.7},

{"김브래",57.7} };

int i, j; // 변수, 3, 기억 클래스,9

for (i = 0; i < 3; i++) { // 제어문, 7

for (j = i + 1; j < 4; j++) { // 연산자, 6

if (man[i].w > man[j].w) {

swap(&man[i], &man[j]);

} // call by reference, 11

}

}

printf(" 이름 \t체중\n");// 표준 라이브러리 함수, 4

for (i = 0; i < 3; i++) {

printf(" %s %5.1f\n", man[i].name, man[i].w);

}

return 0;

} //main()함수 끝

void swap(WEIGHT* mani, WEIGHT* manj)// 포인터, 11

{ //함수 정의

WEIGHT temp;

temp = *mani;

*mani = *manj;

*manj = temp;

}

 

#include <iostream>

using namespace std;

 

int main()

{

cout << "Hello World" << endl;

return 0;

}

 

#include <iostream>

int main()

{std::cout << "Hello World!\n";

}

----------------------------------------------------------------------------------

티스토리 블로그: https://brae.tistory.com/

 

 

'1-2 > C++프로그래밍' 카테고리의 다른 글

C++프로그래밍 6주차 강의 정리  (0) 2022.10.06
C++프로그래밍 4주차 정리  (0) 2022.09.22
C++프로그래밍 3주차 정리  (0) 2022.09.15
C언어 복습 정리  (0) 2022.09.12
C++프로그래밍 2주차  (0) 2022.09.08