Maybe a similar topic has already been discussed. But, I have a different problem. Here, I'm using C++ 20 in Visual Studio
I have code
#include<iostream>
using namespace std;
int main() {
int a;
cin >> a;
switch (a) {
case 1 ... 9:
cout << "satuan" << endl;
break;
case 10 ... 99:
cout << "puluhan" << endl;
break;
case 100 ... 999:
cout << "ratusan" << endl;
break;
case 1000 ... 9999:
cout << "ribuan" << endl;
break;
case 10000 ... 99999:
cout << "puluhribuan" << endl;
break;
}
}
And the problem is
Build started...
1>------ Build started: Project: If Then or Case, Configuration: Debug x64 ------
1>If Then or Case.cpp
1>D:\Multimedia\Teknik Informatika - Komputer - Elektronika\C++\Visual Studio\If Then or Case\If Then or Case.cpp(8,9): error C2143: syntax error: missing ':' before '...'
1>D:\Multimedia\Teknik Informatika - Komputer - Elektronika\C++\Visual Studio\If Then or Case\If Then or Case.cpp(8,9): error C2059: syntax error: '...'
1>D:\Multimedia\Teknik Informatika - Komputer - Elektronika\C++\Visual Studio\If Then or Case\If Then or Case.cpp(11,10): error C2143: syntax error: missing ':' before '...'
1>D:\Multimedia\Teknik Informatika - Komputer - Elektronika\C++\Visual Studio\If Then or Case\If Then or Case.cpp(11,10): error C2059: syntax error: '...'
1>D:\Multimedia\Teknik Informatika - Komputer - Elektronika\C++\Visual Studio\If Then or Case\If Then or Case.cpp(14,11): error C2143: syntax error: missing ':' before '...'
1>D:\Multimedia\Teknik Informatika - Komputer - Elektronika\C++\Visual Studio\If Then or Case\If Then or Case.cpp(14,11): error C2059: syntax error: '...'
1>D:\Multimedia\Teknik Informatika - Komputer - Elektronika\C++\Visual Studio\If Then or Case\If Then or Case.cpp(17,12): error C2143: syntax error: missing ':' before '...'
1>D:\Multimedia\Teknik Informatika - Komputer - Elektronika\C++\Visual Studio\If Then or Case\If Then or Case.cpp(17,12): error C2059: syntax error: '...'
1>D:\Multimedia\Teknik Informatika - Komputer - Elektronika\C++\Visual Studio\If Then or Case\If Then or Case.cpp(20,13): error C2143: syntax error: missing ':' before '...'
1>D:\Multimedia\Teknik Informatika - Komputer - Elektronika\C++\Visual Studio\If Then or Case\If Then or Case.cpp(20,13): error C2059: syntax error: '...'
1>Done building project "If Then or Case.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I have tried my code in C++11 (Using DevC++) and it's work. But, when I tried in C++20 (Using Visual Studio) this error. How can I fix this problem?