바로이순간의 공간

  • 홈
  • 태그
  • 방명록

CIN 3

cin 버퍼에 남은 글자수 세기

#include <iostream> #include <stdio.h> using namespace std; int main() { char ch; cout<<"Enter a string:"; cin>>ch; while(stdin->_cnt>1) { cout<<ch<<" "; cin>>ch; } cout<<ch; return 0; }

c·c++/c++ 프로그래밍 2011.12.03

cin을 이용하여 정수를 안전하게 입력받기.

#include <iostream> #include <limits> using namespace std; int main() { int num1; cout<<"\nEnter first number:\n"; cin>>num1; while(!cin.good()) { //this means while input is not valid, do this. // if input is valid, this code will not execute cin.clear(); //clear the error state //ignore all characters left in the buffer cin.ignore(numeric_li..

c·c++/c++ 프로그래밍 2011.12.03

c++ cin>> 대신 사용하는 안전한 입력방식

#include <iostream> #include <string> #include <sstream> using namespace std; int main() { string input = ""; // How to get a string/sentence with spaces cout << "Please enter a valid sentence (with spaces):\n>"; getline(cin, input); cout << "You entered: " << input << endl << endl; // How to get a number. int myNumb..

c·c++/c++ 프로그래밍 2011.12.03
이전
1
다음
더보기
프로필사진

바로이순간의 공간

  • 분류 전체보기 (542)
    • 알고리즘, 자료구조 (27)
      • 자료구조 (11)
      • 알고리즘 (16)
    • Blockly webc (10)
      • Blockly webc (5)
      • svl에 대하여 (5)
    • c·c++ (357)
      • c 프로그래밍 (314)
      • c++ 프로그래밍 (43)
    • 자바·파이썬·자바스크립트 (35)
      • 파이썬 프로그래밍 (17)
      • Java 프로그래밍 (9)
      • 자바스크립트 (9)
    • 기타 (102)
      • 컴퓨터공학 (63)
      • 과학 (4)
      • 수학 (11)
      • 번역 (24)

Tag

순환호출, 진법변환, CIN, 행렬의 곱셈, 애너그램, 자바스크립트, 단어세기, 피보나치 수열, 재귀호출, c언어 독학,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

«   2025/06   »
일 월 화 수 목 금 토
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

방문자수Total

  • Today :
  • Yesterday :

Copyright © Kakao Corp. All rights reserved.

티스토리툴바