1 CUI CUI CUI 1.1 cout cin 1.1.1 redirect.cpp #i n c l u d e <s t r i n g > 3 using namespace std ; 5 6 i n t main ( void ) 7 { 8 s t r i n g s ; 10 c



Similar documents
1 1.1 *1 1. sep1.cpp main() sep.cpp separate() *1 GNOME KDE 3

1 C STL(1) C C C libc C C C++ STL(Standard Template Library ) libc libc C++ C STL libc STL iostream Algorithm libc STL string vector l

●70974_100_AC009160_KAPヘ<3099>ーシス自動車約款(11.10).indb

Lecture on

REALV5_A4…p_Ł\1_4A_OCF

untitled

「都市から地方への人材誘致・移住促進に関する調査」

<91498EE88CA D815B2E786C73>

〔 大 会 役 員 〕

橡本体資料+参考条文.PDF



新版明解C言語 実践編


joho07-1.ppt

PowerPoint プレゼンテーション - 物理学情報処理演習

273? C

untitled


3.1 stdio.h iostream List.2 using namespace std C printf ( ) %d %f %s %d C++ cout cout List.2 Hello World! cout << float a = 1.2f; int b = 3; cout <<

C , C++ C C++ C++ C cpprefjp - C++ 1 C CUI 2.1 donothing.cpp 1

とても使いやすい Boost の serialization

基礎プログラミング2015



untitled

2

新・明解C言語 実践編

PowerPoint プレゼンテーション - 物理学情報処理演習


Networking Semester 802.3

Microsoft Word - C.....u.K...doc

No.28

(STL) STL 1 (deta structure) (algorithm) (deta structure) 2 STL STL (Standard Template Library) 2.1 STL STL ( ) vector<int> x; for(int i = 0; i < 10;

( ) [18 30] [21 00] 2 3 ( ( ) ) ( ) ( ) a b

design_pattern.key

(F1)

I J

B5‘·¢‡Ì…X…X…†PDFŠp

JPROM-PRINT

untitled

Microsoft Word - ‰IŠv⁄T†`⁄V87†`97.doc

項 目

2

2.8% 2.0% 2.4% 2.4% 0.4% 0.1% 0.3% 0.5% 3.8% 5.6% 25.6% 29.3% 64.6% 60.0% 1

Q&A最低資本金特例 PDF

sbhc01b.ai

bumon_pro.indd

01-.indd

表紙2.eps

indd


/ / / /

.z {..5.15

2012_10_A_cover.indd

‡o‡P†C‡P‡Q”R„û†^‡P†C‡P‡Q

2012_05_GLK_cover.indd


Q & A

D2A操作解説

EPSON

™…

2004cyukan_ir.pdf

PowerPoint プレゼンテーション

文庫●注文一覧表2016c(7月)/岩波文庫


新版 明解C++入門編

1.3 ( ) ( ) C


財団法人母子健康協会第三十回シンポジウム

橡matufw

NewBead_no17_4c_pdf.indd

untitled

O

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

1.ppt

Java updated

ソフトゼミC 第二回 C++の基礎

日本外傷歯学会認定医(平成24年11月30日付) H

untitled

解きながら学ぶC++入門編

WinHPC ppt

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B

double float

SystemC言語概論

改訂版 :基本的な文字化の原則(Basic Transcription System for Japanese: BTSJ)

OpenCV IS Report No Report Medical Information System Labratry

( CUDA CUDA CUDA CUDA ( NVIDIA CUDA I

imagio Wide 7040

第3章 OpenGL の基礎

untitled

- 2 -

コンバートスター15シリーズ 製品パンフレット

基礎プログラミング2015

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裶²ó ¨¡ À©¸æ¹½Â¤¡§·«¤êÊÖ¤· ¨¡

1 ( ) 1.1 (convert.sh) (18GHz 26GHz) C (convert.c, convert1.c) mesure-ryudai convert.sh #!/bin/sh # file1 file1= ls -1 $1 # file1 data for data in $fi

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè11²ó

1. ( ) SPH 1. 1: 2: 2.

& & a a * * ptr p int a ; int *a ; int a ; int a int *a

PowerPoint プレゼンテーション - 物理学情報処理演習

Transcription:

C/C++ 007 6 11 1 CUI 1.1....................................... 1................................ 3 1.3 argc argv................................. 5.1.............................................. 5............................................... 7 1

1 CUI CUI CUI 1.1 cout cin 1.1.1 redirect.cpp #i n c l u d e <s t r i n g > 3 using namespace std ; 5 6 i n t main ( void ) 7 { 8 s t r i n g s ; 10 c i n >> s ; 11 cout << h e l l o, << s << endl ; 1 } g++ redirect.cpp./a > hell.txt

g++ redirect.cpp./a < hell.txt > < > hell.txt >> 1.1. ls *1 grep * ls grep hell ls grep hell./a 1. batch.bat 1 REM r e m R E M REM echo 3 echo hoge a echo hoge a >hoge. txt 5 echo hage a >>hoge. txt *3 CUI GUI *1 Windows ls dir grep * grep sed regular expression *3 3

1.3 argc argv CUI main args.cpp 5 i n t main ( i n t argc / /, char argv [ ] / / ) 6 { 7 cout << << argc << endl ; 8 f o r ( i n t i =1; i < argc ; i++) { 10 cout << argv [ i ] << endl ; 11 } 1 } main() argc 1 argv C/C++

.1 sarray.cpp 5 i n t main ( void ) 6 { 7 char achar [ 1 6 ] ; // c h a r 1 6 8 i n t a i n t [ 5 6 ] ; // i n t 5 6 10 // [ x ] x 11 achar [ 0 ] = A ; // 0 1 achar [ ] = H ; // 5 13 achar [ 7 ] = O ; // 8 1 15 cout << achar [ 0 ] << achar [ ] << achar [ 7 ] << endl ; 16 17 f o r ( i n t i =0; i < 56; i++) { 18 a i n t [ i ] = 55 i ; 1 } 0 f o r ( i n t i =0; i < 56; i++) { 1 cout << a i n t [ i ] << endl ; } 3 } int char string 5

[ ]; 0 ([x]) 0 char a[3] a[] char array[3]; char c; array[0] = a ; c = array[0]; 0 char carray[3] = { a, b, c }; int iarray[] = {13, 56, 7, 135678}; int iarray[6] = {87}; // 0 char carray[] = { a, b, c }; // carray char array[] = { a, b, c, d }; array[] = e ; // array[-1] = Z ; // 6

. pointer.cpp 5 i n t main ( void ) 6 { 7 i n t i ; 8 i n t p ; // i n t 10 i = 13; 11 p = &i ; // & i i 1 cout << p << endl ; // p p i 13 i = 65; 1 cout << p << endl ; 15 p = 78; 16 cout << i << endl ; 17 } * * ; & &..1 return 1 7

struct.cpp 5 s t r u c t S{ 6 i n t i ; 7 char c ; 8 } ; 10 11 s t r u c t S func ( i n t i ) { 1 s t r u c t S r e t ; 13 1 r e t. i = i + 00; 15 r e t. c = A ; 16 17 return r e t ; 18 } 1 0 i n t main ( void ) 1 { s t r u c t S s ; 3 s = func ( 0 ) ; // 5 cout << s. i << endl << s. c << endl ; 6 } 3bit 1MB 3bit Byte > 8

pointer.cpp 5 s t r u c t S{ 6 i n t i ; 7 char c ; 8 } ; 10 11 void func ( s t r u c t S p) { 1 p >i += 00; // ( p ). i += 00 13 p >c = A ; // ( p ). c = A 1 } 15 16 i n t main ( void ) 17 { 18 s t r u c t S s ; 1 0 s. i = 0 ; 1 func(&s ) ; // cout << s. i << endl << s. c << endl ; 3 } return.. C++ reference.cpp

5 s t r u c t S{ 6 i n t i ; 7 char c ; 8 } ; 10 11 void func ( s t r u c t S &r e f ) { 1 r e f. i += 00; 13 r e f. c = A ; 1 } 15 16 i n t main ( void ) 17 { 18 s t r u c t S s ; 1 0 s. i = 0 ; 1 func ( s ) ; // cout << s. i << endl << s. c << endl ; 3 } C..3 char a[16]; char *p = a; char a[16]; char *p = &(a[0]); 10

a[i] *(p+i) pa.cpp 5 6 i n t main ( void ) 7 { 8 char a [ ] = { a, b, c } ; char p= a ; 10 11 cout << p [ 0 ] << p [ 1 ] << p [ ] << endl ; 1 cout << p << (p+1) << (p+) << endl ; 13 1 f o r ( i n t i =0; i < 3 ; i++) 15 cout << p [ i ] ; 16 cout << endl ; 17 18 f o r ( i n t i =0; i < 3 ; i++) 1 cout << p++; 0 cout << endl ; 1 }.. C C \0 char C++ string cstring.cpp 11

5 6 i n t main ( void ) 7 { 8 char s t r = hoge ; char s t r [ ] = hoge ; 10 char s t r 3 [ ] = { h, o, g, e, \0 } ; 11 1 cout << s t r << endl ; 13 cout << s t r << endl ; 1 cout << s t r 3 << endl ; 15 } 1