Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- run()
- 추상클래스
- 생성자
- override
- eclipse
- Hashtable
- value
- constantnumber
- hamobee
- reference
- concreteclass
- Eureka
- overload
- arguments
- methodArea
- hashCode
- string
- garbagecollection
- abstractclass
- Polymorphism
- Vector
- 콘크리트클래스
- fuction
- class
- MSA
- super
- ALTER
- start()
- 객체형변환
- object
Archives
- Today
- Total
뇌운동일지
[명품 C++ 프로그래밍] 2. 프로그래밍의 기본 본문
1.
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
for(int i=1; i<=100; i++){
cout<<i<<'\t';
if(i%10==0){
cout<<endl;
}
}
}
2.
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
for(int i=1; i<=9; i++){
for(int j=1; j<=9; j++){
cout<<j<<'x'<<i<<'='<<i*j<<'\t';
}
cout<<endl;
}
}
3.
#include <iostream>
using namespace std;
int main() {
int i;
int j;
cout << "두 수를 입력하라>>";
cin >> i >> j;
if (i > j) {
cout << "큰 수 =" << i << endl;
}
else {
cout << "큰 수 =" << j << endl;
}
}
4.
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
double inputNum[5];
cout << "5 개의 실수를 입력하라>>";
for (int i = 0; i < 5; i++) {
cin >> inputNum[i];
}
sort(inputNum, inputNum+5);
cout << "제일 큰 수=" << inputNum[4] << endl;
}
5.
#include <iostream>
using namespace std;
int main() {
char arr[100];
int count = 0;
cout << "문자들을 입력하라(100개 미만)" << endl;
cin.getline(arr, 100, '\n');
for (int i = 0; i < 100; i++) {
if (arr[i] == 'x') {
count++;
}
}
cout << "x의 개수는 " << count << endl;
}
6.
#include <iostream>
#include <string>
using namespace std;
int main() {
string pwd1;
string pwd2;
cout << "새 암호를 입력하세요>>";
getline(cin, pwd1);
cout << "새 암호를 다시 한 번 입력하세요 >>";
getline(cin, pwd2);
if (pwd1 == pwd2) {
cout << "같습니다"<<endl;
}
else {
cout << "같지 않습니다"<<endl;
}
}
7.
#include <iostream>
#include <string>
using namespace std;
int main() {
char arr[30];
while (true) {
cout << "종료하고 싶으면 yes를 입력하세요>>";
cin.getline(arr, 30, '\n');
if(strcmp(arr, "yes")==0){
cout << "종료합니다..." << endl;
break;
}
}
}
'오리너구리의 오리발질' 카테고리의 다른 글
[IntelliJ] scratch file (0) | 2021.03.29 |
---|---|
[생존 엑셀] 시트 생성, 시트 이름 변경, Hyperlink (0) | 2021.03.19 |
자주 사용하는 mvn dependency 저장 (0) | 2020.08.03 |
springboot + thymeleaf + jpa (0) | 2020.07.31 |
spring security 메모 (0) | 2020.07.30 |
Comments