inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

176만명의 커뮤니티!! 함께 토론해봐요.

v-bind가 잘이해가 안됩니다 ㅠ

미해결

실습 UI 개발로 배워보는 순수 javascript 와 VueJS 개발

<tabs v-bind:tabs="tabs" v-bind:selected-tab="selectedTab" v-on:@change="onClickTab"> 위처럼 코드가있다고할때 tabs라는 템플릿에 v-bind를 할당하는데 tabs=tabs다 여기서 말하는 첫번째tabs는 속성의 이름이고 뒤에나오는 tabs는 new Vue()에 data{} 오브젝트에 써있는 tabs값인거같은데 tabs="tabs"가 될수있다는게 잘 이해가안됩니다..ㅜ 예를들어 v-bind:class="tabs" 라고한다면 class명으로 new Vue()안에있는 data값중 tabs를 바인딩하는구나 라고 생각되는데 엘레멘트 속성중에 tabs라는게 없을것같고.. data-set으로 tabs를 주게되는건가요?? 실제 html의 모습은 <tabs data-tabs="tabs"> 이런모습이 되는건가요??

  • javascript
  • vuejs
스튜디오블룸 댓글 1 좋아요 1 조회수 156

병합정렬의 구현 소스코드 오류문제가 있는것 같아요.

미해결

C++ 로 배우는 자료구조와 알고리즘

항상 좋은 강의 해주셔서 감사합니다. 덕분에 많이 배우고 있습니다. 근데 소스 코드가 오류가 있는것 같습니다. 제 생각엔 while(second < n) 이부분인데요 a[] = {9,8,7,6,5,4,3,2,1}로 했을경우 1이 쓰레기값이 들어가서 최종 정렬 형태가 -8543456691 23456789 이런식으로 나옵니다.

  • C++
임현규 댓글 0 좋아요 0 조회수 215

배열 질문있습니다!

미해결

C 프로그래밍 - 입문부터 게임 개발까지

물고기 키우기 프로젝트에서 int arrayFish[6]; 이라고 전역변수로 배열을 선언해주셨는데요, 배열파트 강의에서 char str[6] = "coding"; 이라고 선언했을때 출력값이 codingㅁㅁㅁㅁ이런식으로 나오는걸 보고 문자열 마지막에는 끝을 알려주는 NULL 값이 들어가야해서 그 NULL값이 들어갈 자리를 만들어주기 위해 char str[7] = "coding"이라고 작성하면 정상 출력되는걸 배웠습니다. int형으로 배열을 선언해줬을때는 그런게 필요없나요? int arrayFish[6];이고 어항이 6개니까 1~6까지 모든 자리를 차지해서 NULL값이 들어갈 자리가 없는게아닌가요?

  • c
박정재 댓글 1 좋아요 0 조회수 145

접근허용 부탁드립니다.

미해결

Vue.js 중급 강좌 - 웹앱 제작으로 배워보는 Vue.js, ES6, Vuex

인프런 아이디 : pjh267@gmail.com (구글이용자입니다.) 인프런 이메일 : pjh267@gmail.com 깃헙 아이디 : pjh267@gmail.com 깃헙 Username : pjh267 접근허용 부탁드립니다. 아직 허용이 안된것 같에서요.

  • javascript
  • vuejs
  • es6
  • vuex
박주환 댓글 1 좋아요 0 조회수 176

자료 다운이 안됩니다..

미해결

Doit! HTML5 + CSS3 웹 표준의 정석 (전면 개정 1판-2019)

강의의 예제파일들 다운이 안됩니다;;

  • HTML/CSS
신혜정 댓글 0 좋아요 0 조회수 220

그래픽카드가 없는 환경에서는

미해결

OpenCV 강좌 - 컴퓨터 비전

안녕하세요 그래픽카드가 없는 환경(노트북)에서는 CUDA를 실행할 수가 없는데, 없어도 무방한가요?

  • opencv
  • 머신러닝 배워볼래요?
  • 딥러닝
권동현 댓글 2 좋아요 0 조회수 521

상속 관련 궁금한게 있습니다.

미해결

생활코딩 - 자바스크립트(JavaScript) 기본

funtion Ultra() {} Ultra.prototype.ultraProp = true; function Super() {} Super.prototype = new Ultra(); function Sub() {} Sub.prototype = new Super(); Sub.prototype.ultraProp = 3; 위와 같이 소스가 작성돼 있을 때 Sub.prototype의 ultraProp은 Ultra 객체의 ultraProp인건가요 아님 Ultra 객체와는 별개로 Sub객체가 따로 갖고 있는건가요?

  • javascript
이광영 댓글 0 좋아요 0 조회수 171

prototype 강의듣다가 궁금한 게 있습니다.

미해결

생활코딩 - 자바스크립트(JavaScript) 기본

예제소스를 보고 질문을 드리면요 function Person(name) { this.name = name; } Person.prototype.introduce = function() { console.log('My name is ' + this.name); } 소스코드가 이렇게 작성돼 있는 상태에서 콘솔창에서 Person.prototype를 찍어보면 introduce는 나오는데 name 속성은 나오지 않는 이유가 뭔가요?

  • javascript
이광영 댓글 0 좋아요 0 조회수 235

테스트 관련해서 궁금한게 있습니다~!

미해결

스프링 부트 개념과 활용

가끔 책이나 영상, 기선님의 강의를 포함해서 따라하다보면 늘 궁금했던 부분이 있습니다. 테스트를 위해 AssertThat을 사용할 때 어떤 경우엔 Junit에 있는 것을 사용하고 어떤 경우에는 AssertJ에 있는 것을 사용하던데, 어떤 기준으로 구분해서 사용하는지 알 수 있을까요? 그리고 그러한 테스트를 공부하기 위해서는 도움이 될만한 서적이나 사이트 등을 추천해주실 만한 것이 있는지 궁금합니다. 좋은 강의 항상 감사드리고, 앞으로 올라올 Spring MVC 강의도 기대하겠습니다!

  • spring-boot
  • spring
  • java
이요한 댓글 2 좋아요 0 조회수 243

맥에서의 포트접근

미해결

따라하면서 배우는 웹애플리케이션 만들기

<!DOCTYPE html> JavaScript JavaScript란? 변수와상수 연산자 연산자 계산을 할 때 사용되는 것입니다. 이렇게 다 작성해서 맥에서 진행을 하는데 원래 동영상에서는 href=" http://localhost/page_html.html 이렇게 알려주셨는데 이렇게 하고 링크를 들어가보니까 안들어가져서 앞부분 다시 살펴보니까 맥에서는 :8080을 꼭입력해야 한다고 해서 제가 임의로 href=" http://localhost:8080/page_html.html 이렇게 까지 만들었는데 그래도 링크로 바로 연결이 되지않고 누르면 http://localhost/page_html.html 이렇게 나와서 들어가 지지가 않습니다 물론 :8080을 다시 작성하면 되긴하지만 이부분 어떻게 해결을 해야 하는지 궁금합니다!

  • HTML/CSS
  • php
김지석 댓글 1 좋아요 0 조회수 294

"00" 혹은 "000" 입력시에 TextField의 값이 0으로 바뀜

미해결

iOS AutoLayout 완벽 가이드 - 실무 프로젝트를 위한 실전강의

스스로 해결해보라고 하셔서 해결한 내용과 검증을 받고 싶어 질문 남깁니다 ~ 문제는 NumberFormat으로 표시한 comma 때문에 Int로 변환시에 nil 이 되는 문제였고, 아래와 같이 String.replacingOccurrences로 해결하였는데 혹시 더 좋은 방법이 있을지 질문 드립니다. func deliverButtonValue(number: String) { var currentNumber: Int? var newNumber = Int(number)! // customTextField의 string에서 comma를 제거 if let curr = customTextField.text { currentNumber = Int(curr.replacingOccurrences(of: ",", with: "")) } if let hasNumber = currentNumber { if number == "00" { newNumber = hasNumber * 100 } else if number == "000" { newNumber = hasNumber * 1000 } } let formatter = NumberFormatter() formatter.numberStyle = .decimal customTextField.text = formatter.string(from: NSNumber(value: newNumber)) }

  • iOS-Autolayout
  • 모바일-디자인
사리곰탕 댓글 1 좋아요 0 조회수 200

강사님 질문이 있습니다!

미해결

[NLP] IMDB 영화리뷰 감정 분석을 통한 파이썬 텍스트 분석과 자연어 처리

안녕하세요. 강사님이 올려주신 강의를 따라하며 텍스트 감성분석을 해보고 있는 학생입니다.. 개인적으로 다른 사이트의 리뷰를 따로 정리해둔 데이터가 있는데 그 데이터를 test데이터 대신에 넣어서 실제로 활용해도 괜찮을까요? 제가 하고 싶은건 리뷰의 긍정 부정을 예측하는 것인데, 이것을 하기 위해 이 캐글의 튜토리얼을 적용해서 사용해도 결과가 나오는지가 궁금합니다. 그리고 튜토리얼1을 따라해보고 test데이터를 제가 가진 데이터로 바꿔서 해보았더니 결과가 생각보다 정확하게 나오지 않았는데, 정확도를 높이려면 어떤 튜토리얼이 더 좋은지 알고 싶습니다. 머신러닝을 처음 접하는 것이다 보니 질문이 구체적이지 못해서 죄송합니다.. 그리고 강의 감사합니다!

  • python
  • NLP
라따뚜이 댓글 0 좋아요 0 조회수 175

아쉽네요.

미해결

디지털 포렌식 (Digital Forensic) 전문가 과정

디지털포렌식을 처음 접하는 사람입니다. 공부 하는 도중에 VMware를 실행하고 있는데, 강의에서는 어떻게 사용하는지도 안알려줘서 엄청 아쉽네요.

  • Forensic
진동민 댓글 0 좋아요 0 조회수 178

스프링 시큐리티 기본 설정에서 로그인없이 접근불가능과 메인어플리케이션 실행불가능

미해결

스프링 기반 REST API 개발

@Override public void configure(WebSecurity web) throws Exception { web.ignoring().mvcMatchers("/docs/index.html"); web.ignoring().requestMatchers(PathRequest.toStaticResources().atCommonLocations()); } 위 메소드를 통해 localhost:8080/docs/index.html 에 로그인없이 접근이 가능해야하는데 이게 불가능하고 로그인창이 나타나네요 @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .mvcMatchers("/docs/index.html").anonymous() .requestMatchers(PathRequest.toStaticResources().atCommonLocations()); } 1번의 configure(WebSecurity web) 메소드 문제는 일단 냅두고(주석처리) 다음configure(HttpSecurity http) 메소드를 진행해봤는데 해당 메소드를 작성하니 메인어플리케이션이 오류 때문에 아예 실행이 안되네요. jdk 8을 사용해서 그런가 싶어서 jdk 11로 바꿔봤는데도 해결이 안되요...밑에는 에러로그입니다. WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.apache.catalina.loader.WebappClassLoaderBase (file:/C:/Users/kyeongjun/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.12/tomcat-embed-core-9.0.12.jar) to field java.io.ObjectStreamClass$Caches.localDescs WARNING: Please consider reporting this to the maintainers of org.apache.catalina.loader.WebappClassLoaderBase WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release 2019-01-26 20:11:27.043 INFO 1276 --- [ main] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2019-01-26 20:11:27.052 ERROR 1276 --- [ main] o.s.boot.SpringApplication : Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is java.lang.IllegalStateException: An incomplete mapping was found for [org.springframework.boot.autoconfigure.security.servlet.StaticResourceRequest$StaticResourceRequestMatcher@1ba3c03d]. Try completing it with something like requestUrls()..hasRole('USER') at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:625) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:455) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1288) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:307) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) ~[spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) ~[spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE] at com.example.lec1.Lec1Application.main(Lec1Application.java:12) ~[classes/:na] Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is java.lang.IllegalStateException: An incomplete mapping was found for [org.springframework.boot.autoconfigure.security.servlet.StaticResourceRequest$StaticResourceRequestMatcher@1ba3c03d]. Try completing it with something like requestUrls()..hasRole('USER') at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:620) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] ... 21 common frames omitted Caused by: java.lang.IllegalStateException: An incomplete mapping was found for [org.springframework.boot.autoconfigure.security.servlet.StaticResourceRequest$StaticResourceRequestMatcher@1ba3c03d]. Try completing it with something like requestUrls()..hasRole('USER') at org.springframework.security.config.annotation.web.configurers.AbstractConfigAttributeRequestMatcherRegistry.createRequestMap(AbstractConfigAttributeRequestMatcherRegistry.java:111) ~[spring-security-config-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer.createMetadataSource(ExpressionUrlAuthorizationConfigurer.java:198) ~[spring-security-config-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer.createMetadataSource(ExpressionUrlAuthorizationConfigurer.java:81) ~[spring-security-config-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.security.config.annotation.web.configurers.AbstractInterceptUrlConfigurer.configure(AbstractInterceptUrlConfigurer.java:75) ~[spring-security-config-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer.configure(ExpressionUrlAuthorizationConfigurer.java:81) ~[spring-security-config-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.security.config.annotation.web.configurers.AbstractInterceptUrlConfigurer.configure(AbstractInterceptUrlConfigurer.java:67) ~[spring-security-config-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder.configure(AbstractConfiguredSecurityBuilder.java:384) ~[spring-security-config-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder.doBuild(AbstractConfiguredSecurityBuilder.java:330) ~[spring-security-config-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.security.config.annotation.AbstractSecurityBuilder.build(AbstractSecurityBuilder.java:41) ~[spring-security-config-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.security.config.annotation.web.builders.WebSecurity.performBuild(WebSecurity.java:294) ~[spring-security-config-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.security.config.annotation.web.builders.WebSecurity.performBuild(WebSecurity.java:79) ~[spring-security-config-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder.doBuild(AbstractConfiguredSecurityBuilder.java:334) ~[spring-security-config-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.security.config.annotation.AbstractSecurityBuilder.build(AbstractSecurityBuilder.java:41) ~[spring-security-config-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.springSecurityFilterChain(WebSecurityConfiguration.java:104) ~[spring-security-config-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$c881c394.CGLIB$springSecurityFilterChain$5() ~[spring-security-config-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$c881c394$$FastClassBySpringCGLIB$$ef88c264.invoke() ~[spring-security-config-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE] at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$c881c394.springSecurityFilterChain() ~[spring-security-config-5.1.3.RELEASE.jar:5.1.3.RELEASE] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] ... 22 common frames omitted Process finished with exit code 1

  • rest-api
  • java
  • spring
리준 댓글 1 좋아요 0 조회수 1617

질문있습니다 교수님.

미해결

홍정모의 따라하며 배우는 C++

강의 1:10쯤 const double gravity{9.8}; 이라고 했을때 const 때문에 gravity의 값을 못바꾼다고 하셨고 이어서 바꾸는 방법이 있기는 있지만 추천하지 않는다고 하셨습니다. 어떤 방법을 쓰면 const 사용 이후에 값을 변경 할 수 있을까요? 코딩 이후에 단순히 사용한 const를 모두 찾아서 일일이 지우기는 번거로울 것 같기도 해서요. 다른 방법이 있다면 알고 싶습니다!

  • C++
하가현 댓글 2 좋아요 0 조회수 348

안녕하세요 저번 질문 아직 해결 못했어요 ㅠㅠ

미해결

홍정모의 따라하며 배우는 C++

안녕하세요 이전 질문글에서 교수님이 주신 힌트대로 며칠간 고민해보았지만 아직도 답이 안나와서 너무 답답해서 다시 질문 글을 올리게 되었습니다. 다른 힌트 하나만 더 주실 수 있을까요? 뭔가 알것 같으면서도 이상하게 나오니 답답해요. 이전 질문은 아래와 같습니다. 저번 강의인 불리언과 if 에서 배운 조건문을 섞어서 내주신 숙제를 살짝 변경해서 해보려고 했습니다. 입력값을 받고 int형인 경우 ascii 의 알파벳으로, 알파벳을 입력 받는 경우 int형으로 출력되게 해보려고 했었습니다. if에 넣은 내용들은 제대로 값을 출력해주는 반면 else에 해당하는 입력값을 넣으면 빈 숫자가 나오거나 제가 원한 답이 나오질 않습니다. 교수님의 도움을 구하고 싶습니다! 아래는 제 나름 해본 코드 입니다. '''#include include int main() { using namespace std; cout << "Enter a number or an alphabet character : "; int a; char b; if (cin >> a) { cout << a << " " << static_cast<char>(a) << endl; } else { cout << b << " " << static_cast<int>(b) << endl; } return 0; }''' if 안에 cin이 있다고 하셔서 이것을 빼서 여러번 시도해 보았지만 뭐가 문젠지 아직 잘 안됩니다. 일단 아래의 코드처럼 시도해보았는데 여전히 문자를 치면 0이라고 나옵니다. '''#include include int main() { using namespace std; cout << "Enter a number or an alphabet character : "; int a; cin >> a; if (a == static_cast<int>(a)) { cout << a << " " << static_cast<char>(a) << endl; } else { cout << a << " " << static_cast<int>(a) << endl; } return 0; }'''

  • C++
하가현 댓글 2 좋아요 0 조회수 273

인기 태그

인프런 TOP Writers

주간 인기글