top of page

게시판 게시물

이재민
2020년 7월 30일
In 소스 코드 제출
/* #include <iostream> using namespace std; class book { string t; int price,pages; public: book(string t="",int price=0,int pages=0) { this->t=t; this->price=price; this->pages=pages; } void show() { cout << t<<' '<<price <<"원 "<<pages<<" 페이지" <<endl; } string gett() { return t; } bool operator==(int k); bool operator==(string k); bool operator==(book k); }; bool book::operator==(int k) { if(this->price==k) { return true; } else { return false; } } bool book::operator==(string k) { if(gett()==k) { return true; } else { return false; } } bool book::operator==(book k) { if(gett()==k.t&&this->price==k.price&&this->pages==k.pages) { return true; } else { return false; } } int main() { book a("명품",30000,500),b("고품",30000,500); if (a==30000) { cout << "정가 30000원"<<endl; } if (a=="명품") { cout << "명픔" <<endl; } if (a==b) { cout << "같은책"<<endl; } } */ /* #include <iostream> using namespace std; class book { string t; int price,pages; public: book(string t="",int price=0,int pages=0) { this->t=t; this->price=price; this->pages=pages; } void show() { cout << t<<' '<<price <<"원 "<<pages<<" 페이지" <<endl; } string gett() { return t; } friend bool operator==(int k,book i); friend bool operator==(string k,book i); friend bool operator==(book k,book i); }; bool operator==(int k,book i) { if(i.price==k) { return true; } else { return false; } } bool operator==(string k,book i) { if(i.t==k) { return true; } else { return false; } } bool operator==(book k,book i) { if(i.t==k.t&&i.price==k.price&&i.pages==k.pages) { return true; } else { return false; } } int main() { book a("명품",30000,500),b("고품",30000,500); if (30000==a) { cout << "정가 30000원"<<endl; } if ("명품"==a) { cout << "명픔" <<endl; } if (a==b) { cout << "같은책"<<endl; } } */ /* #include <iostream> using namespace std; class book { string t; int price,pages; public: book(string t="",int price=0,int pages=0) { this->t=t; this->price=price; this->pages=pages; } void show() { cout << t<<' '<<price <<"원 "<<pages<<" 페이지" <<endl; } string gett() { return t; } friend bool operator!(book i); }; bool operator !(book i) { if (i.price==0) { return true; } else { return false; } } int main() { book bok("벼룩시장",0,50); if (!bok) { cout << "공짜"<<endl; } } */ #include <iostream> using namespace std; class book { string t; int price,pages; public: book(string t="",int price=0,int pages=0) { this->t=t; this->price=price; this->pages=pages; } void show() { cout << t<<' '<<price <<"원 "<<pages<<" 페이지" <<endl; } string gett() { return t; } friend bool operator <() }; int main() { book a("청춘",20000,300); string b; cout << "책 이름"; getline(cin,b); if (b<a) { cout << a.gett()<<"이 "<<b<< "보다 뒤에 있구나!" <<endl; } }
0
0
2
이재민
2020년 7월 28일
In 소스 코드 제출
/* #include <iostream> #include <string> using namespace std; class au2 { public: static int* concat(int s1[],int s2[],int size) { for (int i=0; i<size; i++) { cout << s1[i] << ' '; } for (int i=0; i<size; i++) { cout << s2[i] << ' '; } cout << endl; } static int *remove(int s1[],int s2[],int size,int &retsize) { for (int i=0; i<size; i++) { for (int j=0; j<size; j++) { if (s1[i]==s2[j]) { s1[i]=0; } } } for (int i=0; i<retsize; i++) { if (s1[i]!=0) { cout << s1[i] << ' '; } } } }; int main() { int cnt=0; int x[5]; int y[5]; for (int i=0; i<5; i++) { cin >> x[i]; } for (int i=0; i<5; i++) { cin >> y[i]; } au2::concat(x,y,5); for (int i=0; i<5; i++) { for (int j=0; j<5; j++) { if (x[i]==y[j]) { cnt++; } } } int k; k=5-cnt; cout << k << endl; au2::remove(x,y,5,k); } */ /* #include <iostream> #include <cstdlib> #include <ctime> using namespace std; class rd { public: static void seed() { srand((unsigned)time(0)); } static int nextint(int min=0,int max=-32767) { int k; for (int i=0; i<10; i++) { k= rand()%100+1; } return k; } static char nextalphabet() { char s; for (int i=0; i<10; i++) { s=rand()%26+96+1; } return s; } static double nextdouble() { int k; for (int i=0; i<10; i++) { k=rand()%100000; } return (double)k/1000000; } }; int main() { cout << "1~100 랜덤정수"<<endl; rd::seed(); for (int i=0; i<10; i++) { cout << rd::nextint(1,100) << ' '; } cout << endl; cout << "알파벳 랜덤 출력"<<endl; rd::seed(); for (int i=0; i<10; i++) { cout << rd::nextalphabet() << ' '; } cout << endl; cout << "랜덤 실수 출력"<< endl; rd::seed(); for (int i=0; i<10; i++) { cout << rd::nextdouble() << ' '; } } */ #include <iostream> #include <string> using namespace std; class trace { public: static void put(string a,string b=) { cout << a <<':'<< b <<endl; } static void print(string c) { cout << c << "정보 출력"<<endl; } }; void f() { int a,b,c; cout << "두개정수입력"; cin >> a >> b; trace::put("f()","정수입력받음"); c=a+b; trace::put("f()","합 계산"); cout << "합은 "<<c <<endl; } int main() { trace::put("main()","프로그램 시작합니다"); f(); trace::put("main()","종료"); trace::put("f()"); trace::print(); }
0
0
2
이재민
2020년 7월 23일
In 소스 코드 제출
/* #include <iostream> using namespace std; class person { int id; double weight; string name; public: person(int i=1,string n="grace",double w=20.5) { this->id=i; this->name=n; this->weight=w; } void show() { cout << id <<' '<< weight <<' '<< name <<endl; } }; int main() { person grace,ashely(2,"ashely"),helen(3,"helen",32.5); grace.show(); ashely.show(); helen.show(); } */ /* #include <iostream> using namespace std; int big(int a,int b,int c=100) { if (c<=100&&b<=100&&a<=100) { if (a<b<c&&c<100) { return c; } else if (a<c<b&&b<100) { return b; } else if (c<a<b&&b<100) { return b; } else if (c<b<a&&a<100) { return a; } else if (b<a<c&&c<100) { return c; } else if (b<c<a&&a<100) { return a; } } else { return 100; } } int main() { int x = big(3,5); int y = big(300,60); int z = big(30,60,50); cout << x << ' ' << y << ' ' << z <<endl; } */ /* #include <iostream> using namespace std; class mv { int *m; int size; public: mv(int n=100,int k=size) { m=new int [n]; for (int i=0; i<k; i++) { m[i]=k; } delete []m; } }; int main() { mv v = new mv; } */ /* #include <iostream> using namespace std; class au2 { int size; public: au2() { } void setnum(int s[]) { } static int* concat(int s1[],int s2[],int size) { } static int* remove(int s1[],int s2[],int size,int& retsize) { } }; int main() { int k; cout << "5개 입력하라. 배열 x에 삽입한다 >>"; cin >> au2::*concat(k); cout << "5개 입력하라. 배열 y에 삽입한다 >>"; cin >> q[i]; } */ #include <iostream> #include <string> using namespace std; class board { public: static int x; static string s; static string add(string s1) { s.append("x: ").append(s1).append("\n"); x++; } static string print() { cout << s << endl; } }; int board::x = 0; string board::s = "------게시판------\n"; int main() { board::add("중"); board::add("코"); board::print(); board::add("경"); board::print(); }
0
0
5
이재민
2020년 7월 21일
In 소스 코드 제출
/* #include <iostream> using namespace std; class circle { int radius; public: circle(const circle &c); circle() { radius=1; } circle(int radius) { this->radius=radius; } double ga() { return 3.14*radius*radius; } }; circle::circle(const circle &c) { this->radius=c.radius; cout << "복사생성자 실현" << radius << endl; } int main() { circle src(30); circle dest(src); cout << src.ga()<<endl; cout << dest.ga() << endl; } */ /* #include <iostream> #include <cstring> using namespace std; class Person { char *name; int id; public: Person(int id,const char *name) { this->id=id; int len=strlen(name); this->name = new char [len+1]; strcpy(this->name,name); } person(const Person &person) { this->id = person.id; int len = strlen(person.name); this->name = new char [len+1]; strcpy(this->name,person.name); cout << "복사 생성자 실행 원본 객체 이름 " << this->name << endl; } ~Person() { if (name) { delete []name; } } void cn(const char *name) { if (strlen(name)>strlen(this->name)) { return; } strcpy(this->name,name); } void show() { cout << id << ','<< name << endl; } }; int main() { Person father(1,"Jaemin"); Person daughter(father); father.show(); daughter.show(); daughter.cn("pig"); father.show(); daughter.show(); } */ /* #include <iostream> using namespace std; class circle { }; void swap(circle &a,circle &b) { circle tmp; tmp=a; a=b; b=tmp; } int main() { circle c; circle d; swap(c,d); } */ /* #include <iostream> using namespace std; void combine(string &t1,string &t2,string &t3) { t3=t1+' '+t2; } int main() { string text1("i love you"),text2("very much"); string text3; combine(text1,text2,text3); cout << text3; } */ /* #include <iostream> using namespace std; class circle { int radius; public: circle(int r) { radius=r; } int getradius() { return radius; } void setradius(int r) { radius=r; } void show() { cout << "반지름이 " << radius << "인 원"<< endl; } }; void increase (circle &a,circle &b) { int k; k=a.getradius()+b.getradius(); a.setradius(k); } int main() { circle x(10); circle y(5); increase(x,y); x.show(); } */ /* #include <iostream> #include <cstring> using namespace std; char &find(char a[],char c,bool &success) { for (int i=0; i<strlen(a); i++) { if (a[i]==c) { success=true; return a[i]; } } } int main() { char s[]="Mike"; bool b = false; char &loc = find (s,'m',b); if (b==false) { cout <<"m을 발견 x" << endl; } loc = 'm'; cout << s << endl; } */ #include <iostream> using namespace std; class mis { int *p; int size; int top; public: mis() { size=1; } mis(int size) { this->size = size; } mis(const mis &s) { this->size = s.size; top=s.top; this->p=p; } ~mis() { delete p; } bool push(int n) { top=n; if (top>n) { return false; } else if (top<n) { return true; } } bool pop(int &n) { n=top; if (top<n) { return false; } else if (top>n) { return true; } } }; int main() { mis a(10); a.push(10); a.push(20); mis b=a; b.push(30); int n; a.pop(n); cout << "스택 a 팝"<< n << endl; b.pop(n); cout << "스택 b 팝"<< n << endl; }
0
0
2
이재민
2020년 7월 16일
In 소스 코드 제출
/* #include <iostream> #include <string> using namespace std; class person { string name; string tel; public: person(); string getname() { return name; } string gettel() { return tel; } void set(string name,string tel) { this->name=name; this->tel=tel; } }; person::person() { this->name=name; } int main() { person s[3]; person *p; char nm[4]; string name1; p=s; for (int i=0; i<3; i++) { string name; string tel; cin >> name >> tel; p[i].set(name, tel); } for (int i=0; i<3; i++) { cout << p[i].getname() << endl; } cin >> name1; for (int i=0; i<4; i++) { if (p[i].getname()==name1) { cout << p[i].gettel() << endl; break; } } } */ #include <iostream> #include <string>0 using namespace std; class ctn { int size; public: ctn() { size=10; } void fill(); void consume(); int getsize(); }; void ctn::consume() { size--; } void ctn::fill() { size=10; } int ctn::getsize() { return size; } class cvm { ctn tong[3]; void fill(); void se(); void sa(); void ss(); void show(); public: void run(); }; void cvm::fill() { for (int i=0; i<3; i++) { } cout << "10 " <<"10 " << "10" << endl; } void cvm::se() { tong[0] tong[1] cout << "ed" << endl; } void cvm::sa() { //tong[0]--; //tong[1]-=2; cout << "ad" << endl; } void cvm::ss() { // tong[0]--; // tong[1]-=2; // tong[2]--; cout << "sd" << endl; } void cvm::run() { } int main() { cvm s; cvm *p=new cvm(); int a; p->run(); while(1) { cin >> a; if (a==4) { // p->show(); } else if (a==1) { // p->se(); } else if (a==2) { // p->sa(); } else if (a==3) { // p->ss(); } else if (a==5) { // p->fill(); } } }
0
0
3
이재민
2020년 7월 14일
In 소스 코드 제출
/* #include <iostream> #include <string> using namespace std; int main() { string s; int cnt; getline(cin,s,'\n'); cnt=s.find('a'); cout << cnt ; } */ /* #include <iostream> #include <string> using namespace std; class sample { int *p; int size; public: sample(int n) { size=n; p=new int [n]; } void read(); void write(); int big(); ~sample(); }; void read() { p } int main() { sample s(10); s.read(); s.write(); cout << s.big(); } */ /* #include <iostream> #include <string> #include <cstdlib> #include <ctime> using namespace std; int main() { string s; getline(cin,s,'\n'); srand((unsigned)time(0)); char a=rand(); s.insert(2,a); cout << s; } */ /* #include <iostream> #include <string> using namespace std; class circle { int radius; public: void setradius(int radius) { this->radius=radius; } double getarea() { return 3.14*radius*radius; } }; int main() { int k; circle circle[3]; for (int i=0; i<3; i++) { cin >> k; circle[i].setradius(k); } int cnt=0; for (int i=0; i<3; i++) { if (circle[i].getarea()>100) { cnt++; } } cout << cnt; } */ #include <iostream> #include <string> using namespace std; class person { string name; string tel; public: person(); string getname() { return name; } string gettel() { return tel; } void set(string name,string tel) { this->name=name; this->tel=tel; } }; person::person() { this->name=name; } int main() { person s[3]; for (int i=0; i<3; i++) { string name; string tel cin >> name >> tel; s[i] = new person(); s[i].set(name, tel); } for (int i=0; i<3; i++) { } for (int i=0; i<3; i++) { } }
0
0
8
이재민
2020년 7월 09일
In 소스 코드 제출
/* #include <iostream> using namespace std; class circle { int radius; public: circle(); circle(int r); ~circle(); void setradius(int r) { radius=r; } double getarea() { return 3.14*radius*radius; } }; circle::circle():circle(1) { } circle::circle(int r) { radius=r; } circle::~circle() { cout << radius << endl; } int main() { circle *p= new circle; circle *q= new circle(30); cout << (*p).getarea()<<endl<<(*q).getarea()<<endl; delete p; delete q; } */ /* #include <iostream> using namespace std; class circle { int radius; public: circle(); circle(int r); ~circle(); void setradius(int r) { radius=r; } double getarea() { return 3.14*radius*radius; } }; circle::circle():circle(1) { } circle::circle(int r) { radius=r; } circle::~circle() { cout << "소멸자실행:"<< radius << endl; } int main() { int radius; while (1) { cin >> radius; if (radius<0) { break; } circle *p=new circle(radius); cout << (*p).getarea() << endl; delete p; } } */ /* #include <iostream> using namespace std; class circle { int radius; public: circle(); circle(int r); ~circle(); void setradius(int r) { radius=r; } double getarea() { return 3.14*radius*radius; } }; circle::circle():circle(1) { } circle::circle(int r) { radius=r; cout << "생성자 실행 " << radius << endl; } circle::~circle() { cout << "소멸자 실행 " << radius << endl; } int main() { circle *p = new circle[3]; for (int i =0; i<3; i++) { p[i].setradius(10*(i+1)); } for (int i =0; i<3; i++) { cout << p[i].getarea()<<endl; } circle *ar=p; for (int i=0; i<3; i++) { cout << ar->getarea() << endl; ar++; } delete [] p; } */ /* #include <iostream> using namespace std; class circle { int radius; public: circle(); ~circle() { }; void setradius(int r) { radius=r; } double getarea() { return 3.14*radius*radius; } }; circle::circle() { radius=1; } int main() { int n,radius; cin >> n; if (n<0) { return 0; } circle *p = new circle [n]; for (int i=0; i<n; i++) { cin >> radius; p[i].setradius(radius); } int count=0; for (int i=0; i<n; i++) { cout << p->getarea(); if (p->getarea()>=100&&p->getarea()<=200) { count++; } p++; } cout << count << endl; delete []p; } */ /* #include <iostream> #include <string> using namespace std; int main() { string str; string address("용인"); string cpad(address); char text[]={'p','i','g','\0'}; string a(text); cout << str << endl; cout << address << endl; cout << cpad << endl; cout << a << endl; } */ /* #include <iostream> #include <string> using namespace std; int main() { string names[5]; for (int i=0; i<5; i++) { cout << "이름 >>" << endl; getline(cin,names[i],'\n'); } string latter = names[0]; for (int i=0; i<5; i++) { if (latter < names[i]) { latter=names[i]; } } cout << "뒤에 나오는거 " << latter << endl; } */ /* #include <iostream> #include <string> using namespace std; int main() { string s; getline(cin,s,'\n'); int len = s.length(); for (int i=0; i<len; i++) { string f=s.substr(0,1); string sub = s.substr(1,len-1); s=sub+f; cout << s << endl; } } */ #include <iostream> #include <string> using namespace std; int main() { string s; getline(cin,s,'\n'); int sum=0; int startindex=0; while(1) { int findex= s.find('+',startindex); if (findex==-1) { string part = s.substr(startindex); if (part=="") { break; } cout << part << endl; sum += stoi(part); break; } int count = findex - startindex; string part = s.substr(startindex,count); cout << part << endl; sum+=stoi(part); startindex=findex+1; } cout << sum << endl; } #include <iostream> #include <string> using namespace std; int main() { string s; getline(cin,s,'&'); cin.ignore(); string f,r; getline(cin,f,'\n'); getline(cin,r,'\n'); int startindex=0; while (1) { int findex=s.find(f,startindex); if (findex==-1) { break; } s.replace(findex,f.length(),r); startindex = findex + r.length(); } cout << s << endl; }
0
0
5
이재민
2020년 7월 07일
In 소스 코드 제출
/* #include <iostream> using namespace std; #include <cstdlib> #include <ctime> class Random { public: int a,b; Random(); Random(int f,int g); int next(); int nextInrange(int x,int y); }; Random::Random() { srand((unsigned)time(0)); } int Random::next() { int k = rand(); return k; } int Random::nextInrange(int x,int y) { while(1) { int k = rand()%(y-x+1); k += 2; if(k%2==0) { return k; } } } int main() { Random r; cout <<"--0에서 " << RAND_MAX <<" 까지의 랜덤정수 10개--"<<endl; for (int i=0; i<10; i++) { int n=r.next(); cout << n << ' '; } cout << endl << endl <<"--2에서 " << " 10까지의 랜덤정수 10개--"<<endl; for (int i=0; i<10; i++) { int n = r.nextInrange(2,10); cout << n << ' '; } cout << endl; } */ /* #include <iostream> using namespace std; #include <cstdlib> #include <ctime> class dice { }; int main() { dice d[100]; dice *np = new dice(); dice *pd = &d; dice *md = (dice *) malloc (sizeof(dice)*5); md[0~4] } */ /* #include <iostream> using namespace std; class circle { int radius; public: circle() { radius=1; } circle(int r) { radius=r; } double getarea(); }; double circle::getarea() { return 3.14*radius*radius; } int main() { circle donut; circle pizza(30); circle *p; p = &donut; cout << (*p).getarea() << endl; } */ /* #include <iostream> using namespace std; class circle { int radius; public: circle() { radius=1; } circle(int r) { radius=r; } void setradius(int r) { radius=r; } double getarea(); }; double circle::getarea() { return 3.14*radius*radius; } int main() { circle arr[3]; arr[0].setradius(10); arr[1].setradius(20); arr[2].setradius(30); circle *p; p=arr; for (int i=0; i<3; i++) { cout << p[i].getarea() << endl; } } */ /* #include <iostream> using namespace std; int main() { int *p; p=new int; if (!p) { cout << "할당 x"; return 0; } *p=5; int n= *p; cout << *p<<endl; cout << n << endl; delete p; } */ /* #include <iostream> using namespace std; int main() { int n; cin >> n; if (n>=0) { return 0; } int *p=new int[n]; if (!p) { cout << "메모리를 할당할수없습니다"; return 0; } for (i=0; i<n; i++) { cin>>p[i]; } int sum=0; for (int i=0; i<n; i++) { sum+=p[i]; } cout << sum/n << endl; delete []p; } */ /* #include <iostream> using namespace std; class circle { int radius; public: circle(); circle(int r); ~circle(); void setradius(int r) { radius=r; } double getarea() { return 3.14*radius*radius; } }; circle::circle() { radius=1; cout << radius <<endl; } circle::circle(int r) { radius=r; cout << radius << endl; } circle::~circle() { cout << radius<< endl; } int main() { circle *p,*q; p=new circle; q=new circle(30); cout << (*p).getarea() << endl << (*q).getarea() << endl; delete p; delete q; } */
0
0
2
이재민
2020년 7월 02일
In 소스 코드 제출
/* #include <iostream> using namespace std; struct a { a(int r) { radius=r; } double ga(); private: int radius; }; double a::ga() { return 3.14*radius*radius; } int main() { a waffle(3); cout << "면적은?"<< waffle.ga(); } */ /* #include <iostream> using namespace std; class Tower { public: int height; Tower(); Tower(int h); int getHeight(); }; Tower::Tower():Tower(1) { } Tower::Tower(int h) { height=h; } int Tower::getHeight() { return height; } int main() { Tower myTower; Tower seoulTower(100); cout <<"높이는 "<<myTower.getHeight() << "미터" << endl; cout <<"높이는 "<<seoulTower.getHeight() << "미터" << endl; } */ /* #include <iostream> #include <string.h> using namespace std; class Date { public: int month,day,year; Date(); Date(int y,int m,int d); Date(char input[100]); int getYear(); int getMonth(); int getDay(); void show(); }; Date::Date(int y,int m,int d) { year = y; month = m; day = d; } Date::Date(char input[]) { year = 0; month = 0; day = 0; for (int i=0; i<strlen(input)+1; i++) { if (i<4) { year *= 10; year += input[i]-'0'; } else if (i==5) { month=input[i]-'0'; } else if (6<i&&i<9) { day*=10; day+=input[i]-'0'; } } } int Date::getYear() { return year; } int Date::getMonth() { return month; } int Date::getDay() { return day; } void Date::show() { cout << year << "년"<< month << "월" << day << "일" << endl; } int main() { Date birth(2014,3,20); Date independanceday("1945/8/15"); independanceday.show(); cout << birth.getYear() << ',' << birth.getMonth() << ',' <<birth.getDay() << endl; } */ /* #include <iostream> #include <string.h> using namespace std; class cm { public: int a,b,c; cm(); cm(int x,int y,int z); void de(); void da(); void ds(); void full(); void show(); }; cm::cm(int x,int y,int z) { a = x; b = y; c = z; } void cm::de() { a=a-1; b=b-1; } void cm::da() { a=a-1; b=b-2; } void cm::ds() { a=a-1; b=b-2; c=c-1; } void cm::full() { a=10; b=10; c=10; } void cm::show () { cout <<"커피머신상태," << "커피:" << a << "물:" << b <<"설탕:" << c << endl; } int main() { cm java(5,10,3); java.de(); java.show(); java.da(); java.show(); java.ds(); java.show(); java.full(); java.show(); } */ /* #include <iostream> #include <string.h> using namespace std; class Integer { public: int a; int set(int x); int get(); Integer(); Integer(int y); Integer(char s[100]); bool isEven(); }; Integer::Integer(int y) { a=y; } int Integer::set(int x) { a=x; } Integer::Integer(char s[]) { a=0; for (int i=0; i<strlen(s); i++) { a*=10; a+=s[i]-48; } } int Integer::get() { return a; } bool Integer::isEven() { return true; } int main() { Integer n(30); cout << n.get() << ' '; n.set(50); cout << n.get() << ' '; Integer m("300"); cout << m.get() << ' '; cout << m.isEven(); } */
0
0
3
이재민
2020년 6월 30일
In 소스 코드 제출
/* #include <iostream> using namespace std; class Circle { public: int radius; double getArea(); }; double Circle::getArea() { return 3.14*radius*radius; } int main() { Circle donut; donut.radius=1; double area = donut.getArea(); cout << "도넛면적은? "<< area << endl; Circle pizza; pizza.radius=30; area = pizza.getArea(); cout << "피자면적은?"<< area << endl; } */ /* #include <iostream> using namespace std; class rectangle { public: int width; int height; int getarea(); }; int rectangle::getarea() { return width*height; } int main() { rectangle rect; rect.width=3; rect.height=5; cout << "삼각형 ?"<< rect.getarea() <<endl; } */ /* #include <iostream> using namespace std; class Circle { public: int radius; Circle(); Circle(int r); double getArea(); }; Circle::Circle() { radius = 1; cout << "반지름?" << radius << "원 생성" << endl; } Circle::Circle(int r) { radius = r; cout << "반지름?" << radius << "원 생성" << endl; } double Circle :: getArea() { return 3.14*radius*radius; } int main() { Circle donut; cout << "도넛 면적?"<<donut.getArea()<<endl; Circle pizza(30); cout << "피자 면적?" << pizza.getArea()<< endl; } */ /* #include <iostream> using namespace std; class Circle { public: int radius; Circle(); Circle(int r); double getArea(); }; Circle::Circle():Circle(1) { } Circle::Circle(int r) { radius = r; cout << "반지름?" << radius << "원 생성" << endl; } double Circle::getArea() { return 3.14*radius*radius; } int main() { Circle donut; cout << "도넛 면적은?"<< donut.getArea() << endl; Circle pizza(30); cout << "피자면적은?"<< pizza.getArea() << endl; } */ /* #include <iostream> using namespace std; class point { int x,y; public: point(); point(int a,int b); void show() { cout << "(" << x <<"," << y << ")" << endl; } }; point::point():point(0,0) { } point::point(int a,int b) :x(a),y(b) { }; int main() { point origin; point target(10,20); origin.show(); target.show(); } */ /* #include <iostream> using namespace std; class rectangle { public: int width,height; rectangle(); rectangle(int w,int h); rectangle(int length); bool isquare(); }; rectangle::rectangle() { width= height =1; } rectangle::rectangle(int w,int h) { width = w; height = h; } rectangle::rectangle (int length) { width=height=length; } bool rectangle::isquare() { if (width == height) return true; else return false; } int main() { rectangle rect1; rectangle rect2(3,5); rectangle rect3(3); if (rect1.isquare()) cout << "rect1은 정사각형"<<endl; if (rect2.isquare()) cout << "rect2는 정사각형"<<endl; if (rect3.isquare()) cout << "rect3는 정사각형"<<endl; } */ /* #include <iostream> using namespace std; class circle { public: int radius; circle(); circle(int r); ~circle(); double getarea(); }; circle::circle():circle(1) { } circle::circle(int r) { radius=r; cout << "반지름" << radius << "원 생성"<< endl; } circle::~circle() { cout << "반지름" << radius << "원 소멸"<< endl; } double circle::getarea() { return 3.14*radius*radius; } int main() { circle donut; circle pizza(30); return 0; } */ /* #include <iostream> using namespace std; class circle { public: int radius; circle(); circle(int r); ~circle(); double getarea(); }; circle::circle():circle(1) { } circle::circle(int r) { radius=r; cout << "반지름" << radius << "원 생성"<< endl; } circle::~circle() { cout << "반지름" << radius << "원 소멸"<< endl; } circle x(1000); circle y(1000); void f() { circle a(100); circle b(200); } double circle::getarea() { return 3.14*radius*radius; } int main() { circle donut; circle pizza(30); f(); return 0; } */
0
0
1
이재민
2020년 6월 25일
In 소스 코드 제출
/* #include <stdio.h> #include <math.h> int v[100000]; int s,e; void swap(int x,int y) { int temp; temp=v[x]; v[x]=v[y]; v[y]=temp; } int pt(int start,int end) { s=start+1; e=end; while (s<=e) { while (v[start]>v[s]) { s++; } while (v[start]<v[e]) { e--; } if (s<=e) { swap(s,e); } } swap(start,e); return e; } void qs(int g,int h) { int j; if (g<=h) { j=pt(g,h); qs(g,j-1); qs(j+1,h); } } int main() { int a,b,k=0,c=0,t=0; int sa, sb; scanf("%d %d",&a,&b); sa = sqrt(a); sb = sqrt(b); for (int i=1; i<=sb; i++) { if (a%i==0) { if(i<=sa) { v[k]=i; k++; if(i!=a/i) { v[k]=a/i; k++; } } c=1; } if (b%i==0&&(a!=b)) { if (c==1) { if (b/i!=i) { v[k]=b/i; k++; } } else { if (b/i!=i) { if(i!=a) { v[k]=i; k++; } if(b/i!=a) { v[k]=b/i; k++; } } else { if(i!=a) { v[k]=i; k++; } } } } c=0; } qs(0,k-1); for (int i=0; i<k; i++) { printf("%d ",v[i]); } } */ /* #include <stdio.h> int main() { int s[100000001]={}; int n,m,i,a; scanf("%d",&n); for (i=1; i<=n; i++) { scanf("%d",&a); s[a]=i; } scanf("%d",&m); for (i=1; i<=m; i++) { scanf("%d",&a); if (s[a]==0) { printf("-1 "); } else { printf("%d ",s[a]); } } return 0; } */ #include <stdio.h> int main() { int n,m,i,a,b,sum=0,t; int s[100004]={}; scanf("%d %d",&n,&m); for (i=1; i<=n; i++) { scanf("%d",&t); s[i]=t; } for (i=1; i<=m; i++) { scanf("%d %d",&a,&b); if (s[a]<=) } }
0
0
0
이재민
2020년 6월 23일
In 소스 코드 제출
#include <stdio.h> #include <math.h> int v[32000]; int s,e; void swap(int x,int y) { int temp; temp=v[x]; v[x]=v[y]; v[y]=temp; } int pt(int start,int end) { s=start+1; e=end; while (s<=e) { while (v[start]>v[s]) { s++; } while (v[start]<v[e]) { e--; } if (s<=e) { swap(s,e); } } swap(start,e); return e; } void qs(int g,int h) { int j; j=pt(g,h); if (g<=h) { qs(g,j-1); qs(j+1,h); } } int main() { int a,b,k=0,c=0,t=0; int sa, sb; for (int i=0; i<5; i++) { scanf("%d",&v[i]); } { //scanf("%d %d",&a,&b); /* sa = sqrt(a); sb = sqrt(b); for (int i=1; i<=sb; i++) { if (a%i==0) { if(i<=sa) { v[k]=i; k++; if(i!=a/i) { v[k]=a/i; k++; } } c=1; } if (b%i==0&&(a!=b)) { if (c==1) { if (b/i!=i) { v[k]=b/i; k++; } } else { if (b/i!=i) { if(i!=a) { v[k]=i; k++; } if(b/i!=a) { v[k]=b/i; k++; } } else { if(i!=a) { v[k]=i; k++; } } } } c=0; } */ } qs(0,4); for (int i=0; i<5; i++) { printf("%d ",v[i]); } }
0
0
3
이재민
2020년 6월 18일
In 소스 코드 제출
/* #include <stdio.h> #include <math.h> int v[32000],s,e; void swap(int x,int y) { int temp; temp=v[x]; v[x]=v[y]; v[y]=temp; } int pt(int start,int end) { s=start+1; e=end; while (s<=e) { while (v[start]>=v[s]) { s++; } while (v[start]<v[e]) { e--; } if (s<e) { swap(s,e); } } swap(start,e); return e; } void qs(int g,int h) { int j; j=pt(g,h); if (g<=h) { qs(g,j-1); qs(j+1,h); } } int main() { int a,b,k=0,c=0; scanf("%d %d",&a,&b); for (int i=1; i<=sqrt(b); i++) { if (a%i==0 && i<=sqrt(a)) { v[k]=i; k++; if(i!=a/i) { v[k]=a/i; k++; } c=1; } if (b%i==0&&(a!=b)) { if (c==1) { v[k]=b/i; k++; } else { if (b%a!=0) { v[k]=i; k++; } if (b/i!=i) { v[k]=b/i; k++; } } } c=0; } //qs(0,k); for (int i=0; i<k; i++) { printf("%d ",v[i]); } } */ /* #include <stdio.h> #include <math.h> int v[1000],s,e; void swap(int x,int y) { int temp; temp=v[x]; v[x]=v[y]; v[y]=temp; } int pt(int start,int end) { s=start+1; e=end; while (s<=e) { while (v[start]>=v[s]) { s++; } while (v[start]<v[e]) { e--; } if (s<e) { swap(s,e); } } swap(start,e); return e; } void qs(int g,int h) { int j; j=pt(g,h); if (g<=h) { qs(g,j-1); qs(j+1,h); } } int main() { int a,b,k=0,c=0; scanf("%d %d",&a,&b); for (int i=1; i<=sqrt(b); i++) { if (a%i==0 && i<=sqrt(a)) { v[k]=i; k++; if(i!=a/i) { v[k]=a/i; k++; } c=1; } if (b%i==0&&(a!=b)) { if (c==1) { v[k]=b/i; k++; } else { v[k]=i; k++; if (b/i!=i) { v[k]=b/i; k++; } } } c=0; } //qs(0,k); for (int i=0; i<k; i++) { printf("%d ",v[i]); } } */
0
0
3
이재민
2020년 6월 16일
In 소스 코드 제출
#include <stdio.h> #include <math.h> int v[10000],s,e; void swap(int x,int y) { int temp; temp=v[x]; v[x]=v[y]; v[y]=temp; } int pt(int start,int end) { s=start+1; e=end; while (s<=e) { while (v[start]>=v[s]) { s++; } while (v[start]<v[e]) { e--; } if (s<e) { swap(s,e); } } swap(start,e); return e; } void qs(int g,int h) { int j; j=pt(g,h); if (g<=h) { qs(g,j-1); qs(j+1,h); } } int main() { int a,b,k=1; scanf("%d %d",&a,&b); for (int i=1; i<=sqrt(b); i++) { if (a%i==0) { v[k]=i; k++; v[k]=a/i; k++; } else if (b%i==0) { v[k]=i; k++; v[k]=b/i; k++; } } for (int i=1; i<=b; i++) { printf("%d \n",v[i]); } qs(1,k-1); }
0
0
2
이재민
2020년 6월 15일
In 소스 코드 제출
#include <stdio.h> int v[5000000000],s,e,i,b,j; void pull() { for (i=1; i<=b; ++i) { if (v[i]) { printf("%d ",v[i]); } } } void swap(int x,int y) { int temp; temp=v[x]; v[x]=v[y]; v[y]=temp; } int parti(int start,int end) { s=start+1; e=end; while (s<=e) { while (v[start]>=v[s]) { s++; } while (v[start]<v[e]) { e--; } if (s<e) { swap(s,e); } } swap(start,e); return e; } void quick(int o,int p) { int c; c=parti(o,p); if (o<p) { quick(o,c-1); quick(c+1,p); } } int main() { int a; scanf("%d %d",&a,&b); for (i=1; i<=b; i++) { if (b%i==0||a%i==0) { v[i]=i; } } pull(); quick(1,b); }
0
0
5
이재민
2020년 6월 09일
In 소스 코드 제출
#include <stdio.h> int n,i,j; char s[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; void insert() { for (i=0; i<n; i++) { if (i>=n) { break; } else if (i==n-1) { printf("%c",s[i]); } else if (i>26&&i<n) { insert(i%26); } } } int main() { int k,t=0,temp; scanf("%d",&n); insert(); }
0
0
4
이재민
2020년 6월 02일
In 소스 코드 제출
#include <stdio.h> struct coke { int g; int cnt; int ou; }; struct coke array[50001]; int s,e,i,j,n; void swap(int a,int b) { int temp; temp=array[a].g; array[a].g=array[b].g; array[b].g=temp; temp=array[a].cnt; array[a].cnt=array[b].cnt; array[b].cnt=temp; temp=array[a].ou; array[a].ou=array[b].ou; array[b].ou=temp; } int parti(int start,int end) { s=start+1; e=end; while (s<=e) { while (array[start].g>=array[s].g) { s++; } while (array[start].g<array[e].g) { e--; } if (s<e) { swap(s,e); } else { break; } } swap(start,e); return e; } int parti1(int start1,int end1) { s=start1+1; e=end1; while (s<=e) { while (array[start1].cnt>=array[s].cnt) { s++; } while (array[start1].cnt<array[e].cnt) { e--; } if (s<e) { swap(s,e); } else { break; } } swap(start1,e); return e; } void quick(int d,int f) { int k; if (d<f) { k=parti(d,f); quick(d,k-1); quick(k+1,f); } } void quick1(int d,int f) { int k; if (d<f) { k=parti1(d,f); quick1(d,k-1); quick1(k+1,f); } } void insert() { for (i=0; i<n; i++) { array[i].ou=i; } } int main() { scanf("%d",&n); for (i=0; i<n; i++) { scanf("%d",&array[i].g); array[i].cnt=i; } quick(0,n-1); insert(); quick1(0,n-1); for (i=0; i<n; i++) { printf("%d ",array[i].ou); } }
0
0
1
이재민
2020년 6월 01일
In 소스 코드 제출
/* #include <stdio.h> struct array { int a; int b; }; int main() { int i,n,j,k=0,temp; struct array s[50001]; scanf("%d",&n); for (i=0; i<n; i++) { scanf("%d",&s[i].a); s[i].b=0; } for (i=0; i<n; i++) { for (j=0; j<n; j++) { if (s[i].a<s[j].a) { s[j].b++; } } } for (i=0; i<n; i++) { printf("%d ",s[i].b); } } */ /* #include <stdio.h> int x[100001],s,e; void swap(int a,int b) { int temp; temp=x[a]; x[a]=x[b]; x[b]=temp; } int partition(int start,int end) { s=start+1; e=end; while (s<=e) { while (x[start]>=x[s]) { s++; } while (x[start]<x[e]) { e--; } if (s<e) { swap(s,e); } } swap(start,e); return e; } void quicksort(int d,int f) { int k; k=partition(d,f); if (d<f) { quicksort(d,k-1); quicksort(k+1,f); } } int main() { int n,i,j; scanf("%d",&n); for (i=0; i<n; i++) { scanf("%d",&x[i]); } quicksort(0,n-1); for (i=0; i<n; i++) { printf("%d\n",x[i]); } } */
0
0
6
이재민
2020년 5월 31일
In 소스 코드 제출
/* #include <stdio.h> int main() { int i,n,a,s[100004]={},j; scanf("%d",&n); for (i=0; i<n; i++) { scanf("%d",&a); s[a]++; } for (i=0; i<100004; i++) { for (j=0; j<s[i]; j++) { printf("%d ",i); } } } */ /* #include <stdio.h> int main() { int i,j,s[8],max=1,idx; for (i=0; i<7; i++) { scanf("%d",&s[i]); } for (i=0; i<2; i++) { max=1; for (j=0; j<7; j++) { if (max<s[j]) { max=s[j]; idx=j; } } printf("%d\n",max); s[idx]=0; } } */ #include <stdio.h> int main() { int i,j,temp,s[50001],n,max,idx; scanf("%d",&n); for (i=0; i<n; i++) { scanf("%d",&s[i]); } for (i=0; i<n; i++) { if (s[i]>max) { max=s[i]; } } }
0
0
1
이재민
2020년 5월 21일
In 소스 코드 제출
/* #include <stdio.h> int n,i,j,k=0,a,b,c=0,d,e,s; int qd[800]; void swap(int idx1,int idx2) { int temp= qd[idx1]; qd[idx1]=qd[idx2]; qd[idx2]=temp; } int change(int start,int end) { int pivot=qd[start]; s=start+1; e=end; while (s<=e) { while(qd[s]<pivot) { s++; } while(qd[e]>pivot) { e--; } if (s<=e) swap(s,e); } { swap(start,e); return e; } } void quick(int t,int g) { int v; if (t<=g) { v=change(t,g); quick(t,v-1); quick(v+1,g); } } int main() { for (i=0; i<8; i++) { scanf("%d",&qd[i]); } quick(0,7); for (i=0; i<8; i++) { printf("%d ",qd[i]); } } */ #include <stdio.h> int s[4500001]; void swap(int n1,int n2) { int temp= s[n1]; s[n1]=s[n2]; s[n2]=temp; } int qnsgkf(int start,int end) { int o,p,pivot=s[start]; o=start+1; p=end; while (o<=p) { while (pivot>=s[o]) { o++; } while (pivot<s[p]) { p--; } if (o<p) { swap(o,p); } } swap(start,p); return p; } int quick(int a,int b) { int g; if (a<b) { g=qnsgkf(a,b); quick(a,g-1); quick(g+1,b); } } int main() { int n,i; scanf("%d",&n); for (i=0; i<n; i++) { scanf("%d",&s[i]); } quick(0,n-1); for (i=0; i<n; i++) { printf("%d ",s[i]); } }
0
0
6

이재민

더보기
bottom of page