ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1000. A+B Problem

Trouble with the A+B problem
Posted by Maxim 13 Sep 2011 23:58
Hi, i'm trying to solve the A+B problem, and it works on my computer. But the compiler of this site doesn't accept my solution. It says "Compilation error" :

"11e2cd04-2636-421c-9639-3a45ac221379
11e2cd04-2636-421c-9639-3a45ac221379(4) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int"

here is my program:

#include <iostream>
using namespace std;

main () {
     long a,b;
     cin >> a;
     cin >> b;
     cout << a+b;
 };
 Where did I do mistakes?
Thank you for attention.
Re: Trouble with the A+B problem
Posted by Kleninz 17 Sep 2011 09:20
try this:

#include <iostream>
using namespace std;

int main () {
     long a,b;
     cin >> a;
     cin >> b;
     cout << a+b;
 }
Re: Trouble with the A+B problem
Posted by Maxim 17 Sep 2011 21:27
But, it's the same. (:
Re: Trouble with the A+B problem
Posted by divya 23 Sep 2011 22:42
I think the difference is in return type of main.
Kindly correct if i am wrong.
Re: Trouble with the A+B problem
Posted by divya 23 Sep 2011 22:43
I think the difference is in return type of main.
Kindly correct if i am wrong.
Re: Trouble with the A+B problem
Posted by Maxim 24 Sep 2011 03:21
Thank you so much! Finally it worked!
Re: Trouble with the A+B problem
Posted by Anupam Roy 27 Sep 2011 20:49
#include<stdio.h>

 void main()
{
    float a,b,s=0.0;
    scanf("%f%f",&a,&b);
    s=a+b;
    printf("sum=%f",s) ;
}
i don't know where is problem in this programme

Edited by author 27.09.2011 20:50
Re: Trouble with the A+B problem
Posted by Nikita Glashenko [Samara SAU] 15 Oct 2011 15:50
use int, lol

Edited by author 15.10.2011 15:51
Re: Trouble with the A+B problem
Posted by 114081EU 20 Oct 2011 15:16
no "return"
Re: Trouble with the A+B problem
Posted by ReadMe 23 Oct 2011 00:06
This is an example problem. You should read an FAQ to get start.
Re: Trouble with the A+B problem
Posted by Th3_g0d 25 Oct 2011 19:58
First of all you haven't shown the type of main function :)
Re: Trouble with the A+B problem
Posted by green_smile 7 Nov 2011 21:28
output must be as this :
cout <<(a+b);
or:
cout <<'a+b';


sorry for my English)