criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
int main(){
    char num[1001];
    int sum;
    while(1){
        if(num == '0') break;
        scanf("%c",num);
        
        sum = 0;
        for(int i = 0; num[i] != '\0'; i++){
            sum += num[i] - '0';
        }
        printf("%d",sum);
    }
    return 0;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    8 |         if(num == '0') break;
      |            ~~~~^~~~~~
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
int main(){
    char num[1001];
    int sum;
    while(1){
        scanf("%c",num);
        if(num == '0') break;
        sum = 0;
        for(int i = 0; num[i] != '\0'; i++){
            sum += num[i] - '0';
        }
        printf("%d",sum);
    }
    return 0;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |         if(num == '0') break;
      |            ~~~~^~~~~~
Language: C++

#include<iostream>
using namespace std;
int main(){
    char num={}
    while(1){
        int sum=0;
        cin>>num;
        if(num[0]==='0'){
            break;
        }
        for(int i=0;i<str.size();i++){
            sum=sum+sum[i]-'0';
        }
    
        cout<<sum<<endl;
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:5: error: expected ',' or ';' before 'while'
    5 |     while(1){
      |     ^~~~~
Language: C++

#include<iostream>
using namespace std;
int main(){
    char num={};
    while(1){
        int sum=0;
        cin>>num;
        if(num[0]==='0'){
            break;
        }
        for(int i=0;i<str.size();i++){
            sum=sum+sum[i]-'0';
        }
    
        cout<<sum<<endl;
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:15: error: invalid types 'char[int]' for array subscript
    8 |         if(num[0]==='0'){
      |               ^
a.cc:8:20: error: expected primary-expression before '=' token
    8 |         if(num[0]==='0'){
      |                    ^
a.cc:11:23: error: 'str' was not declared in this scope; did you mean 'std'?
   11 |         for(int i=0;i<str.size();i++){
      |                       ^~~
      |                       std
a.cc:12:24: error: invalid types 'int[int]' for array subscript
   12 |             sum=sum+sum[i]-'0';
      |                        ^
Language: C++

#include<iostream>
using namespace std;
int main(){
    char num={};
    while(1){
        int sum=0;
        cin>>num;
        if(num[0]=='0'){
            break;
        }
        for(int i=0;i<str.size();i++){
            sum=sum+sum[i]-'0';
        }
    
        cout<<sum<<endl;
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:15: error: invalid types 'char[int]' for array subscript
    8 |         if(num[0]=='0'){
      |               ^
a.cc:11:23: error: 'str' was not declared in this scope; did you mean 'std'?
   11 |         for(int i=0;i<str.size();i++){
      |                       ^~~
      |                       std
a.cc:12:24: error: invalid types 'int[int]' for array subscript
   12 |             sum=sum+sum[i]-'0';
      |                        ^
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
    string num={};
    while(1){
        int sum=0;
        cin>>num;
        if(num[0]=='0'){
            break;
        }
        for(int i=0;i<.size();i++){
            sum=sum+sum[i]-'0';
        }
    
        cout<<sum<<endl;
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:23: error: expected primary-expression before '.' token
   12 |         for(int i=0;i<.size();i++){
      |                       ^
a.cc:13:24: error: invalid types 'int[int]' for array subscript
   13 |             sum=sum+sum[i]-'0';
      |                        ^
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
    string num;
    while(1){
        int sum=0;
        cin>>num;
        if(num[0]=='0'){
            break;
        }
        for(int i=0;i<.size();i++){
            sum=sum+sum[i]-'0';
        }
    
        cout<<sum<<endl;
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:23: error: expected primary-expression before '.' token
   12 |         for(int i=0;i<.size();i++){
      |                       ^
a.cc:13:24: error: invalid types 'int[int]' for array subscript
   13 |             sum=sum+sum[i]-'0';
      |                        ^
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
    string num;
    while(1){
        int sum=0;
        cin>>num;
        if(num[0]=='0'){
            break;
        }
        for(int i=0;i<str.size();i++){
            sum=sum+sum[i]-'0';
        }
    
        cout<<sum<<endl;
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:23: error: 'str' was not declared in this scope; did you mean 'std'?
   12 |         for(int i=0;i<str.size();i++){
      |                       ^~~
      |                       std
a.cc:13:24: error: invalid types 'int[int]' for array subscript
   13 |             sum=sum+sum[i]-'0';
      |                        ^
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
    string num;
    while(1){
        int sum=0;
        cin>>num;
        if(num[0]=='0'){
            break;
        }
        for(int i=0;i<num.size();i++){
            sum=sum+sum[i]-'0';
        }
    
        cout<<sum<<endl;
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:24: error: invalid types 'int[int]' for array subscript
   13 |             sum=sum+sum[i]-'0';
      |                        ^
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
    string num;
    while(1){
        int sum=0;
        cin>>num;
        if(num[0]=='0'){
            break;
        }
        for(int i=0;i<num.size();i++){
            sum=sum+str[i]-'0';
        }
    
        cout<<sum<<endl;
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: 'str' was not declared in this scope; did you mean 'std'?
   13 |             sum=sum+str[i]-'0';
      |                     ^~~
      |                     std
Language: C++

#include<iostream>
#include<cctype>
#include<cstdio>
using namespace std;

int main(){
    char ch[1000] = {};
    int i = 0;
    int sum = 0;
    while(1){
        scan("%c", ch[i]);
        if(ch[i] == 0 && ch[i - 1] == '\n'){
            break;
        } else if (ch[i] == '\n'){
            printf("%c\n", sum);
            sum = 0;
        } else {
            sum += ch[i];
        }
        i += 1;
        
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'scan' was not declared in this scope; did you mean 'scanf'?
   11 |         scan("%c", ch[i]);
      |         ^~~~
      |         scanf
Language: C++


#include<iostream>
#include<cstdio>
using namespace std;

int main(){
    char ch[1000];


    while(1){
        scanf("%s", ch);
        int sum = 0;
        if(ch[0] == '0'){
            break;
        }

        for(int i = 0; i < strlen(ch); i++){
            sum += 'ch[i]' - '0';
        }
        printf("%d\n", sum);
        
        
    }
    return 0;
}


Compiler output:
a.cc:18:20: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
   18 |             sum += 'ch[i]' - '0';
      |                    ^~~~~~~
a.cc: In function 'int main()':
a.cc:17:28: error: 'strlen' was not declared in this scope
   17 |         for(int i = 0; i < strlen(ch); i++){
      |                            ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<cstdio>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include<iostream>
#include<cstdio>
include<cstring>
using namespace std;

int main(){
    char ch[1000];


    while(1){
        scanf("%s", ch);
        int sum = 0;
        if(ch[0] == '0'){
            break;
        }

        for(int i = 0; i < strlen(ch); i++){
            sum += 'ch[i]' - '0';
        }
        printf("%d\n", sum);
        
        
    }
    return 0;
}


Compiler output:
a.cc:18:20: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
   18 |             sum += 'ch[i]' - '0';
      |                    ^~~~~~~
a.cc:3:1: error: 'include' does not name a type
    3 | include<cstring>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:17:28: error: 'strlen' was not declared in this scope
   17 |         for(int i = 0; i < strlen(ch); i++){
      |                            ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<cstdio>
  +++ |+#include <cstring>
    3 | include<cstring>
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
int main(){
    int i,j;
    char name[1000];
    while(1){
        cin >>name;
        
        if (name[0]=='0')break;
        for (j=0;j<1000;j++){
            i=name[j]-'0';
            
            if(name[j]=='\n')break;
        }
        cout<<k<<endl;
    }
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:16:15: error: 'k' was not declared in this scope
   16 |         cout<<k<<endl;
      |               ^
Language: C++

main(){
  int i,num=0;
  string number;
  while(1){
  cin >> number;
  if(number=="0")break;
  
  
  for(i=0;i<number.size();i++){

    num+=number[i] -'0';
   
  }
  cout << num<<endl;
  num=0;
    }
}

Compiler output:
a.cc:1:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    1 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:3:3: error: 'string' was not declared in this scope
    3 |   string number;
      |   ^~~~~~
a.cc:5:3: error: 'cin' was not declared in this scope
    5 |   cin >> number;
      |   ^~~
a.cc:5:10: error: 'number' was not declared in this scope
    5 |   cin >> number;
      |          ^~~~~~
a.cc:14:3: error: 'cout' was not declared in this scope
   14 |   cout << num<<endl;
      |   ^~~~
a.cc:14:16: error: 'endl' was not declared in this scope
   14 |   cout << num<<endl;
      |                ^~~~
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;

int main() {
    char x[1001];
    int i;
    while(1) {
        i=0;
        scanf("%s", x)
        while(x[i] - '0'){
            sum += x[i];
            i++;
        }
    if(sum == 0) break;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:23: error: expected ';' before 'while'
   10 |         scanf("%s", x)
      |                       ^
      |                       ;
   11 |         while(x[i] - '0'){
      |         ~~~~~          
a.cc:15:8: error: 'sum' was not declared in this scope
   15 |     if(sum == 0) break;
      |        ^~~
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;

int main() {
    char x[1001];
    int i, sum=0;
    while(scanf("%s\n", x) {
        sum = 0;
        if (x[0] == '0') break;
        for(i=0; x[i] != 0; i++)
            sum += x[i] - '0';
        cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:27: error: expected ')' before '{' token
    8 |     while(scanf("%s\n", x) {
      |          ~                ^~
      |                           )
a.cc:14:2: error: expected '}' at end of input
   14 | }
      |  ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <string>

useing namespace std;

int main() {
 string number;
 int sum;

 while(1) {
  cin >> number;
  if (number.length() == 1 && number[0] - '0' == 0) break;
  sum = 0;
  for (int i = 0; i < number.length(); i++) sum += number[i] - '0';
  cout << num << endl;
 }

 return 0;
}

Compiler output:
a.cc:4:1: error: 'useing' does not name a type
    4 | useing namespace std;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:7:2: error: 'string' was not declared in this scope
    7 |  string number;
      |  ^~~~~~
a.cc:7:2: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:11:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   11 |   cin >> number;
      |   ^~~
      |   std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:11:10: error: 'number' was not declared in this scope
   11 |   cin >> number;
      |          ^~~~~~
a.cc:15:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   15 |   cout << num << endl;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:15:11: error: 'num' was not declared in this scope; did you mean 'sum'?
   15 |   cout << num << endl;
      |           ^~~
      |           sum
a.cc:15:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   15 |   cout << num << endl;
      |                  ^~~~
      |                  std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <iostream>
#include <string>

using namespace std;

int main() {
 string number;
 int sum;

 while(1) {
  cin >> number;
  if (number.length() == 1 && number[0] - '0' == 0) break;
  sum = 0;
  for (int i = 0; i < number.length(); i++) sum += number[i] - '0';
  cout << num << endl;
 }

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:11: error: 'num' was not declared in this scope; did you mean 'sum'?
   15 |   cout << num << endl;
      |           ^~~
      |           sum
Language: C++

#include<iostream>
#include<cctype>
#include<cstdio>
#include<string>
using namespace std;
int main(){
string num;
while(true){
cin>>num;int sum=0;

for(int i=0;i<num.size();i++){
	sum+=num[i]-'0';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:2: error: expected '}' at end of input
   13 | }
      |  ^
a.cc:8:12: note: to match this '{'
    8 | while(true){
      |            ^
a.cc:13:2: error: expected '}' at end of input
   13 | }
      |  ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include <stdio.h>
#include <stdlib.h>

using namespace std;

int main(){

        int sum = 0;
        char num;

        while(true){
                scanf("%c",&num);
                if(num == '0') break;
                
                while(num != '\n'){
                        sum += atoi(&num);
                        scanf("%c",&num);
                }
                cout << sum << "\n";
                sum = 0;
        }
        return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:17: error: 'cout' was not declared in this scope
   19 |                 cout << sum << "\n";
      |                 ^~~~
a.cc:3:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <stdlib.h>
  +++ |+#include <iostream>
    3 |
Language: C++

#include<iostream>
using namespace std;

int main(){
	char number[1000];
	while(1){
		cin >> number;
		if(number[0] == 0) break;
		int sum = 0;
		for(int i = 0; i < strlen(number); i++){
			sum += number[i];
		}
	}

		return 0
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:36: error: 'strlen' was not declared in this scope
   10 |                 for(int i = 0; i < strlen(number); i++){
      |                                    ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
a.cc:15:25: error: expected ';' before '}' token
   15 |                 return 0
      |                         ^
      |                         ;
   16 | }
      | ~
Language: C++

#include <iostream>
//#include <cstring>
#include <stdio.h>
using namespace std;

int main(){
	char c[100][1000];
	int a;
	
	for (int i=0;i<100;i++){
		scanf("%s",c[i]);
		//if (c[i][0] == '0' && c[i][1] == NULL) {
		if (strcmp(c[i],"0") == 0) {
			a = i;
			break; 
		}
	}
	for (int i=0;i<=a;i++){
		int sum = 0;
		for (int j=0;j<1000;j++){
			if (c[i][j] == '\0') break;
			sum += c[i][j] - 48;
		}
		cout << sum << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: 'strcmp' was not declared in this scope
   13 |                 if (strcmp(c[i],"0") == 0) {
      |                     ^~~~~~
a.cc:2:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | //#include <cstring>
Language: C++

#include<stdio.h>
int main()
{
	char num[1001];
	int i, sum;
		sum = 0;
		scanf("%s", &num[1001]);
		if(num[0] = '0')break;
		for( i = 0; 1 <= 1000; i++ )
		{
			num[i] = num[i] - 48;
		}
		for( i = 0; i <= 1000; i++ )
		{
			sum = sum + num[i];
		}
		printf("%d", sum);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:33: error: break statement not within loop or switch
    8 |                 if(num[0] = '0')break;
      |                                 ^~~~~
Language: C++

#include <iostream>
#include <vector>
#include<string>

using namespace std;

int main(){

	int sum;
	string data;

	for (;;){//0???????????´????????°????????????

		getline(cin, data);
		sum = 0;

		for (int i = 0; data[i]; i++){

			sum += data[i] - '0';

		}if (sum == 0)break;
		cout << sum << endl;
		
	}




	return 0;
}



	return 0;
}

Compiler output:
a.cc:34:9: error: expected unqualified-id before 'return'
   34 |         return 0;
      |         ^~~~~~
a.cc:35:1: error: expected declaration before '}' token
   35 | }
      | ^
Language: C++

//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_B
#include <iostream>
#include <string>
using namespace std;

int count(string x){
  //string?????°???????????????????¶????????????????
  int sum = 0;
  while(1){
    int n = stoi(x.back());
    sum += n;
    x.pop_back();
  }
  return sum;
}

int main(){
  string x;
  while(cin >> x){
    if(x == "0") break;
    else cout << count(x) << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int count(std::string)':
a.cc:10:17: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
   10 |     int n = stoi(x.back());
      |             ~~~~^~~~~~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
 4164 |   stoi(const string& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
 4164 |   stoi(const string& __str, size_t* __idx = 0, int __base = 10)
      |        ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
 4432 |   stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
 4432 |   stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
      |        ~~~~~~~~~~~~~~~^~~~~
Language: C++

#include <iostream>
//#include <string>
#include <cstring>
using namespace std;

/*int main(){
	string x, y;
	int num;
	while (1){
		cin >> x;
		if (x == "0")break;
		int sum = 0;
		for (int i = 0;i<x.length(); i++){
			y.assign(x, i, 1);
			num = stoi(y);
			sum += num;
		}
		cout << sum << endl;
	}
	return 0;
}*/

int main(){
	char x[1001];
	int num;
	bool f=0;
	while (1){
		scanf_s("%s", x, 1001);
		if (x[0]==0) break;
		int sum = 0;
		for (int i = 0; i < strlen(x); i++){
			num = x[i] - '0';
			sum += num;
		}
		cout << sum << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   28 |                 scanf_s("%s", x, 1001);
      |                 ^~~~~~~
      |                 scanf
Language: C++

#include <iostream>
#include <cstring>
using namespace std;

int main(){
	char x[1001];
	int num;
	bool f=0;
	while (1){
		scanf_s("%s", x);
		if (x[0]==0) break;
		int sum = 0;
		for (int i = 0; i < strlen(x); i++){
			num = x[i] - '0';
			sum += num;
		}
		cout << sum << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   10 |                 scanf_s("%s", x);
      |                 ^~~~~~~
      |                 scanf
Language: C++

#include <stdio.h>
#include <string.h>

int main(){
	char x[1001];
	int num;
	bool f=0;
	while (1){
		scanf_s("%s", x,1001);
		if (x[0]=='0') break;
		int sum = 0;
		for (int i = 0; i < strlen(x); i++){
			num = x[i] - '0';
			sum += num;
		}
		printf("%d\n",sum);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    9 |                 scanf_s("%s", x,1001);
      |                 ^~~~~~~
      |                 scanf
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <stdio.h>
#include <cstring>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <numeric>

//#include <map>

using namespace std;

int main()
{

	while (1)
	{
		char ch[1000];
		char* pch;
		pch = ch;
		memset(ch, 0, sizeof(ch));

		string x;
		cin >> x;
		if (x == "0")break;
		
		strcpy_s(ch, x.c_str());
		int sum = 0;
		int index = 0;
		while (*pch)
		{
			sum += (*pch - 0x30);
			pch++;
		}
		cout << sum << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:17: error: 'strcpy_s' was not declared in this scope; did you mean 'strcpy'?
   31 |                 strcpy_s(ch, x.c_str());
      |                 ^~~~~~~~
      |                 strcpy
Language: C++

#include <iostream>
#include <string>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	int x = 0;
	string s;
	char c;
	while(1){
		cin >> s;
		if(stoi(s) == 0){
			break;
		}
		for(int i = 0; i < s.size(); i++){
//			cout << s[i] << endl;
			c = s[i];
			x += atoi(&c);
		}
		cout << x << endl;
	}

	return 0;
}

Compiler output:
a.cc:6:22: error: '_TCHAR' has not been declared
    6 | int _tmain(int argc, _TCHAR* argv[])
      |                      ^~~~~~
Language: C++

include<csdio>
include<cstring>
using namespace std;

int main(){
 char str[1001];
 
 while(1){
  int sum = 0;
  scanf("%s", str);
  
  if(strcmp(str, '0') != NULL) break;

  for(int i = 0; str[i] != "\0"; i++){
   sum += str[i] - '0';
  }

  printf("%d\n", sum);

 }

 return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<csdio>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:10:3: error: 'scanf' was not declared in this scope
   10 |   scanf("%s", str);
      |   ^~~~~
a.cc:12:6: error: 'strcmp' was not declared in this scope
   12 |   if(strcmp(str, '0') != NULL) break;
      |      ^~~~~~
a.cc:1:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | include<csdio>
a.cc:12:26: error: 'NULL' was not declared in this scope
   12 |   if(strcmp(str, '0') != NULL) break;
      |                          ^~~~
a.cc:1:1: note: 'NULL' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
  +++ |+#include <cstddef>
    1 | include<csdio>
a.cc:14:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   14 |   for(int i = 0; str[i] != "\0"; i++){
      |                  ~~~~~~~^~~~~~~
a.cc:18:3: error: 'printf' was not declared in this scope
   18 |   printf("%d\n", sum);
      |   ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | include<csdio>
Language: C++

include<cstdio>
include<cstring>
using namespace std;

int main(){
 char str[1001];
 
 while(1){
  int sum = 0;
  scanf("%s", str);
  
  if(strcmp(str, '0') != NULL) break;

  for(int i = 0; str[i] != "\0"; i++){
   sum += str[i] - '0';
  }

  printf("%d\n", sum);

 }

 return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<cstdio>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:10:3: error: 'scanf' was not declared in this scope
   10 |   scanf("%s", str);
      |   ^~~~~
a.cc:12:6: error: 'strcmp' was not declared in this scope
   12 |   if(strcmp(str, '0') != NULL) break;
      |      ^~~~~~
a.cc:1:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | include<cstdio>
a.cc:12:26: error: 'NULL' was not declared in this scope
   12 |   if(strcmp(str, '0') != NULL) break;
      |                          ^~~~
a.cc:1:1: note: 'NULL' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
  +++ |+#include <cstddef>
    1 | include<cstdio>
a.cc:14:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   14 |   for(int i = 0; str[i] != "\0"; i++){
      |                  ~~~~~~~^~~~~~~
a.cc:18:3: error: 'printf' was not declared in this scope
   18 |   printf("%d\n", sum);
      |   ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | include<cstdio>
Language: C++

#include<cstdio>
#include<cstring>
using namespace std;

int main(){
 char str[1001];
 
 while(1){
  int sum = 0;
  scanf("%s", str);
  
  if(strcmp(str, '0') != NULL) break;

  for(int i = 0; str[i] != "\0"; i++){
   sum += str[i] - '0';
  }

  printf("%d\n", sum);

 }

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:18: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   12 |   if(strcmp(str, '0') != NULL) break;
      |                  ^~~
      |                  |
      |                  char
In file included from /usr/include/c++/14/cstring:43,
                 from a.cc:2:
/usr/include/string.h:156:50: note:   initializing argument 2 of 'int strcmp(const char*, const char*)'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                                      ~~~~~~~~~~~~^~~~
a.cc:12:26: warning: NULL used in arithmetic [-Wpointer-arith]
   12 |   if(strcmp(str, '0') != NULL) break;
      |                          ^~~~
a.cc:14:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   14 |   for(int i = 0; str[i] != "\0"; i++){
      |                  ~~~~~~~^~~~~~~
Language: C++

#include<iostream>
#include<string>
#include<cmath>
using namespace std;

int main() {
	char c[1001];
	int x, i, sum = 0;
	while (1) {
		cin >> c;
		if (c[0] == '0')break;
		x = atoi(c);
		for (i = 0; i < strlen(c); i++) {
			sum += x % 10;
			x /= 10;
		}
		cout << sum << endl;
		sum = 0;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:33: error: 'strlen' was not declared in this scope
   13 |                 for (i = 0; i < strlen(c); i++) {
      |                                 ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<cmath>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include<iostream>
#include<cstdlib>
#include<string>
#include<cmath>
using namespace std;

int main() {
	char c[1001];
	int x, i, sum = 0;
	while (1) {
		cin >> c;
		if (c[0] == '0')break;
		x = atoi(c);
		for (i = 0; i < strlen(c); i++) {
			sum += x % 10;
			x /= 10;
		}
		cout << sum << endl;
		sum = 0;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:33: error: 'strlen' was not declared in this scope
   14 |                 for (i = 0; i < strlen(c); i++) {
      |                                 ^~~~~~
a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include<cmath>
  +++ |+#include <cstring>
    5 | using namespace std;
Language: C++

#include <iostream>
#include <string>
#include <typeinfo>
using namespace std;

int main(){
	string x;
	while (cin >> x){
		if (stoi(x) == 0) break;
		long n = 0;
		for (long i = 0; i < x.size(); i++){
			n += stoi(x[i]);
		}
		cout << n << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:34: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
   12 |                         n += stoi(x[i]);
      |                              ~~~~^~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
 4164 |   stoi(const string& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
 4164 |   stoi(const string& __str, size_t* __idx = 0, int __base = 10)
      |        ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
 4432 |   stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
 4432 |   stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
      |        ~~~~~~~~~~~~~~~^~~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
	long long long long int x,a,c;
	while(1){
		c=0;
		cin >> x;
		if(x==0)break;
		else{
			while(1){
				a=x-(x/10)*10;
				x=(x-a)/10;
				c+=a;
				if(x==0)break;
			}
			cout << c <<endl;
		}
		
	}
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:19: error: 'long long long' is too long for GCC
    5 |         long long long long int x,a,c;
      |                   ^~~~
a.cc:5:24: error: 'long long long' is too long for GCC
    5 |         long long long long int x,a,c;
      |                        ^~~~
Language: C++

#include <string>
#include <iostream>

using namespace std;

int main() {
    char str[1001];
    while(1) {
        cin >> str;
        if(str[0] == '0') break;
        int sum = 0;
        for (int i = 0; i < strlen(str); ++i) {
            sum += (str[i] - '0');
        }
        cout << sum << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:29: error: 'strlen' was not declared in this scope
   12 |         for (int i = 0; i < strlen(str); ++i) {
      |                             ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <iostream>
  +++ |+#include <cstring>
    3 |
Language: C++

#include <string>
#include <iostream>

using namespace std;

int main() {
    char str[1001];
    
    while(1) {
        cin >> str;
        if(str[0] == '0') break;
        int sum = 0;
        for (int i = 0; i < strlen(str); ++i) {
            sum += (str[i]);
        }
        cout << sum << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:29: error: 'strlen' was not declared in this scope
   13 |         for (int i = 0; i < strlen(str); ++i) {
      |                             ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <iostream>
  +++ |+#include <cstring>
    3 |
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main(){
	string s;

	cin >> s;

	while(s!=null){	
		char char[] = s;
		int int[s.size()];
		int x=0;

		for(int i=0;i<s.size();i++){
			int[i] = char[i] - ???0???;
		}

		for(int j=0;j<s.size();j++){
			x += int[j];
		}

		if(x != 0)	cout << x << endl;

		cin >> s;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:18: error: 'null' was not declared in this scope
   10 |         while(s!=null){
      |                  ^~~~
a.cc:11:17: error: two or more data types in declaration of 'structured binding'
   11 |                 char char[] = s;
      |                 ^~~~
a.cc:11:26: error: empty structured binding declaration
   11 |                 char char[] = s;
      |                          ^~
a.cc:12:26: error: expected ']' before '.' token
   12 |                 int int[s.size()];
      |                          ^
      |                          ]
a.cc:12:17: error: two or more data types in declaration of 'structured binding'
   12 |                 int int[s.size()];
      |                 ^~~
a.cc:12:34: error: expected initializer before ';' token
   12 |                 int int[s.size()];
      |                                  ^
a.cc:15:31: error: use of 's' before deduction of 'auto'
   15 |                 for(int i=0;i<s.size();i++){
      |                               ^
a.cc:16:28: error: structured binding declaration cannot have type 'int'
   16 |                         int[i] = char[i] - ???0???;
      |                            ^~~
a.cc:16:28: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:16:29: error: redeclaration of 'auto i'
   16 |                         int[i] = char[i] - ???0???;
      |                             ^
a.cc:15:25: note: 'int i' previously declared here
   15 |                 for(int i=0;i<s.size();i++){
      |                         ^
a.cc:16:34: error: expected primary-expression before 'char'
   16 |                         int[i] = char[i] - ???0???;
      |                                  ^~~~
a.cc:16:34: error: expected ';' before 'char'
a.cc:19:31: error: use of 's' before deduction of 'auto'
   19 |                 for(int j=0;j<s.size();j++){
      |                               ^
a.cc:20:30: error: expected primary-expression before 'int'
   20 |                         x += int[j];
      |                              ^~~
a.cc:25:24: error: use of 's' before deduction of 'auto'
   25 |                 cin >> s;
      |                        ^
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main(){
	string s;

	cin >> s;

	while(s!=""){	
		char c[] = s;
		int i[s.size()];
		int x=0;

		for(int i=0;i<s.size()-1;i++){
			i[i] = c[i] - '0';
		}

		for(int j=0;j<s.size()-1;j++){
			x += i[j];
		}

		if(x != 0)	cout << x << endl;

		cin >> s;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:28: error: initializer fails to determine size of 'c'
   11 |                 char c[] = s;
      |                            ^
a.cc:11:28: error: array must be initialized with a brace-enclosed initializer
a.cc:16:26: error: invalid types 'int[int]' for array subscript
   16 |                         i[i] = c[i] - '0';
      |                          ^
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main(){
	string s;

	cin >> s;

	while(s!=""){	
		char c[s.size()] = s;
		int i[s.size()];
		int x=0;

		for(int k=0;k<s.size()-1;k++){
			i[k] = c[k] - '0';
		}

		for(int j=0;j<s.size()-1;j++){
			x += i[j];
		}

		if(x != 0)	cout << x << endl;

		cin >> s;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:36: error: array must be initialized with a brace-enclosed initializer
   11 |                 char c[s.size()] = s;
      |                                    ^
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main(){
	string s;

	cin >> s;

	while(s!=""){	
		char c[] = s;
		int i[s.size()];
		int x=0;

		for(int k=0;k<s.size()-1;k++){
			i[k] = c[k] - '0';
		}

		for(int j=0;j<s.size()-1;j++){
			x += i[j];
		}

		if(x != 0)	cout << x << endl;

		cin >> s;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:28: error: initializer fails to determine size of 'c'
   11 |                 char c[] = s;
      |                            ^
a.cc:11:28: error: array must be initialized with a brace-enclosed initializer
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main(){
	string s;

	cin >> s;

	while(s!=""){	
		char c[1000] = s;
		int i[s.size()];
		int x=0;

		for(int k=0;k<s.size()-1;k++){
			i[k] = c[k] - '0';
		}

		for(int j=0;j<s.size()-1;j++){
			x += i[j];
		}

		if(x != 0)	cout << x << endl;

		cin >> s;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:32: error: array must be initialized with a brace-enclosed initializer
   11 |                 char c[1000] = s;
      |                                ^
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main(){
	string s;

	cin >> s;

	while(s!=""){	
		char c[1000] = s;
		int i[1000];
		int x=0;

		for(int k=0;k<s.size()-1;k++){
			i[k] = c[k] - '0';
		}

		for(int j=0;j<s.size()-1;j++){
			x += i[j];
		}

		if(x != 0)	cout << x << endl;

		cin >> s;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:32: error: array must be initialized with a brace-enclosed initializer
   11 |                 char c[1000] = s;
      |                                ^
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main(){
	string s;

	cin >> s;

	while(s!="0"){	
		char c[1000] = s;
		int i[1000];
		int x=0;

		for(int k=0;k<s.size()-1;k++){
			i[k] = c[k] - '0';
		}

		for(int j=0;j<s.size()-1;j++){
			x += i[j];
		}

		cin >> s;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:32: error: array must be initialized with a brace-enclosed initializer
   11 |                 char c[1000] = s;
      |                                ^
Language: C++

#include <stdio.h>
int main()
{
  long long n,k1,k2,k3,k4,sum;
  while(1){
    scanf("%d",&n);
    if(n==0){
      break;
    }
    while(1){
      k1=n%10;
      sum=sum+k1;
      n=(n-k1)/10;
      if(n<=0){
	break;
      }
    }
    printf("%d",sum);
    return 0;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:20:4: error: expected '}' at end of input
   20 |   }
      |    ^
a.cc:3:1: note: to match this '{'
    3 | {
      | ^
Language: C++

#include <stdio.h>
int main()
{
  long long n,k1,sum;
  while(1){
    scanf("%lld",&n);
    if(n==0){
      break;
    }
    while(1){
      k1=n%10;
      sum=sum+k1;
      n=(n-k1)/10;
      if(n<=0){
	break;
      }
      print("%d",sum);
    }
    return 0;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:7: error: 'print' was not declared in this scope; did you mean 'printf'?
   17 |       print("%d",sum);
      |       ^~~~~
      |       printf
Language: C++

#include <stdio.h>
int main()
{
  char moji[1001],cou;
  int sum;
  while(1){
    scanf("%s",moji);
    moji[0]='\n';
    sum=0;
    cou=0;
    while(1){
      cou=cou++;
      if(moji[cou]='\n';){
	break;
      }
      sum=sum+moji[cou];
    }
    printf("%d",sum);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:25: error: expected primary-expression before ')' token
   13 |       if(moji[cou]='\n';){
      |                         ^
Language: C++

#include <stdio.h>
int main()
{
  char moji[1001];
  int sum,cou,tn;
  while(1)
    scanf("%s",moji);
    if(moji[0]=='0'){
      break;
    }
    sum=0;
    cou=0;
    while(1){
      if(moji[cou]=='\0'){
	break;
      }
      tn=moji[cou]-'0';
      sum=sum+tn;
      cou=cou+1;
    }
    printf("%d\n",sum);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:7: error: break statement not within loop or switch
    9 |       break;
      |       ^~~~~
a.cc: At global scope:
a.cc:23:3: error: expected unqualified-id before 'return'
   23 |   return 0;
      |   ^~~~~~
a.cc:24:1: error: expected declaration before '}' token
   24 | }
      | ^
Language: C++

#include <iostream>
#include <string>

using namespace std;

int main(int argc, char* argv[]) {
  while (true) {
    double in; cin >> in;
    if (in == 0) break;
    int s = 0;
    while(true) {
      s += in % 10;
      in /= 10;
      if (in == 0) break;
    }
    cout << s << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:12:15: error: invalid operands of types 'double' and 'int' to binary 'operator%'
   12 |       s += in % 10;
      |            ~~ ^ ~~
      |            |    |
      |            |    int
      |            double
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main(){
	char s[1001];

	while(cin >> s){
		int sum = 0;
		if(s=="0") break;
		for(int i=0; i<strlen(s); i++){
			sum +=s[i]-'0';
		}

		cout << sum << "\n";
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:32: error: 'strlen' was not declared in this scope
   11 |                 for(int i=0; i<strlen(s); i++){
      |                                ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | #include <string>
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main(){
	char s[1001];

	while(cin >> s){
		int sum = 0;
		if(s[0]=='0') break;
		for(int i=0; i<strlen(s); i++){
			sum +=s[i]-'0';
		}

		cout << sum << "\n";
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:32: error: 'strlen' was not declared in this scope
   11 |                 for(int i=0; i<strlen(s); i++){
      |                                ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | #include <string>
Language: C++

#include<iostream>
#include<string>
using namespace std;

int main(){
	char str[1001];

	while(1){
		scanf("%s",str);
		if(str[0]=='0')break;
		int sum=0;
		for(int i=0;i<strlen(str);i++){
			sum+=(str[i]-'0');
		}
		printf("%d\n",sum);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:31: error: 'strlen' was not declared in this scope
   12 |                 for(int i=0;i<strlen(str);i++){
      |                               ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | #include<string>
Language: C++

#include<iostream>
using namespace std;

int main(){
	char str[1001];

	while(1){
		scanf("%s",str);
		if(str[0]=='0')break;
		int sum=0;
		for(int i=0;i<strlen(str);i++){
			sum+=(str[i]-'0');
		}
		printf("%d\n",sum);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:31: error: 'strlen' was not declared in this scope
   11 |                 for(int i=0;i<strlen(str);i++){
      |                               ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

#include <iostream>
using namespace std;

int main(){

	string str;

	while(1){

		int sum=0;
		getline(cin,str);

		if(str[i]==0) break;

		for(int i=0; i<str.size(); i++){
			sum += str[i];
		}
		cout << sum << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:24: error: 'i' was not declared in this scope
   13 |                 if(str[i]==0) break;
      |                        ^
Language: C++


#include<iostream>
#inclede<cstdio>
using namespace std;
  
int main()
{
    int b,sum;
	char number[1001];//?????????
	
	while(1){
		sum = 0;
		while(1){
			cin >> number;
			if(number == 0){
				break;
			}
			b = number -'0';//????????? number ????????? i ?????°????????????
			sum = sum + b;
		}
 		if(c == 0){
 			break;
 		}
		cout << sum << endl;
	}
	return 0;
}

	

Compiler output:
a.cc:3:2: error: invalid preprocessing directive #inclede; did you mean #include?
    3 | #inclede<cstdio>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:18:36: error: invalid conversion from 'char*' to 'int' [-fpermissive]
   18 |                         b = number -'0';//????????? number ????????? i ?????°????????????
      |                             ~~~~~~~^~~~
      |                                    |
      |                                    char*
a.cc:21:20: error: 'c' was not declared in this scope
   21 |                 if(c == 0){
      |                    ^
Language: C++


#include<iostream>
#inclede<cstdio>
using namespace std;
  
int main()
{
    int b,sum;
	char number[1001];//?????????
	
	while(1){
		sum = 0;
		while(1){
			cin >> number;
			if(number == 0){
				break;
			}
			b = number -'0';//????????? number ????????? i ?????°????????????
			sum = sum + b;
		}
 		if(sum == 0){
 			break;
 		}
		cout << sum << endl;
	}
	return 0;
}

Compiler output:
a.cc:3:2: error: invalid preprocessing directive #inclede; did you mean #include?
    3 | #inclede<cstdio>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:18:36: error: invalid conversion from 'char*' to 'int' [-fpermissive]
   18 |                         b = number -'0';//????????? number ????????? i ?????°????????????
      |                             ~~~~~~~^~~~
      |                                    |
      |                                    char*