Submission #2119929


Source Code Expand

#include <iostream>

int main() {
	int a, b, x:
	int r;
	cin >> x >> a >> b;

	r = (x - a) % b;

	cout << r << endl;

	return 0;
}

Submission Info

Submission Time
Task A - Buying Sweets
User matasuke0513
Language C++14 (GCC 5.4.1)
Score 0
Code Size 142 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:4:13: error: expected initializer before ‘:’ token
  int a, b, x:
             ^
./Main.cpp:6:2: error: ‘cin’ was not declared in this scope
  cin >> x >> a >> b;
  ^
./Main.cpp:6:2: note: suggested alternative:
In file included from ./Main.cpp:1:0:
/usr/include/c++/5/iostream:60:18: note:   ‘std::cin’
   extern istream cin;  /// Linked to standard input
                  ^
./Main.cpp:6:9: error: ‘x’ was not declared in this scope
  cin >> x >> a >> b;
         ^
./Main.cpp:8:2: error: ‘r’ was not declared in this scope
  r = (x - a) % b;
  ^
./Main.cpp:10:2: error: ‘cout’ was not declared in this scope
  cout << r << endl;
  ^
./Main.cpp:10:2: note: suggested alternative:
In file included from ./Main.cpp:1:0:
/usr/include/c++/5/iostream:61:18: note:   ‘std::cout’
   extern ostream cout;  /// Linked to standard output
                  ^
./Main.cpp:10:15: error: ‘endl’ was not declared in this scope
  cout << r << endl;
               ^
./Main.cpp:10:15: ...