-
C++연습) Array input and output입력받고 입력받은 값 출력하기(DevC++돌림,VisualStudio에러남 원인모르겠음)코딩Coding/C++_연습 2020. 12. 1. 08:09728x9012345678910111213141516171819202122232425#include <iostream>#include <iomanip>using namespace std;int main(){int num_list[100];int y;cout << " Please provide some integers (up to 100). Enter 0 to exit. " << endl;cin >> y;//Loop that obtains the numbersfor (int y = 0; y < 100 && num_list[y-1] !=0; y++){cout << "Enter number " << y << " : " << endl;//obtains the numbers and stores//them in the array num-listcin >> num_list[y];}cout << "You entered " << y << "numbers." << endl;cout << "Here they are: " << endl;cout << "Index " << y << ": " << endl;}
cs 결과
http://cplusplus.com/forum/beginner/75344/Array input and output help - C++ Forum
y is already declared on line 8, remove that and you should not have issues anymore. You should also start your for loop at 1 since 0-1 is out of bounds for an array. Edit, oops, leave line 8, remove the int from your for loop. I didn't realize you were us
cplusplus.com
반응형'코딩Coding > C++_연습' 카테고리의 다른 글
C++연습_내가 입력한 숫자가 홀수(odd)나 짝수(even)인지 구별 하여 출력하기 (0) 2020.12.20 C++연습_문자열(내가 친 단어를(이름5개)) 순서대로 정렬하여 출력하기_최종본 (0) 2020.12.20 C++연습_문자열(내가 친 단어를) 순서대로 정렬하여 출력하기 (0) 2020.12.20 C++)to sort an array in Descending Order& Ascending Order (0) 2020.12.11 C++) 난수생성 후 내림차순 정렬(Descending), 오름차순 정렬(Ascending) (0) 2020.11.30 C++연습)마일을 킬로미터로 변환 (0) 2020.11.29 2D Transformation : Scaling in C++ (0) 2020.11.28 C++연습_반복되는 문자 숫자 세기_입력하는거로 수정해야함 (0) 2020.11.28