|
|
back to boardHi, 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. try this: #include <iostream> using namespace std; int main () { long a,b; cin >> a; cin >> b; cout << a+b; } But, it's the same. (: I think the difference is in return type of main. Kindly correct if i am wrong. I think the difference is in return type of main. Kindly correct if i am wrong. Thank you so much! Finally it worked! #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 use int, lol Edited by author 15.10.2011 15:51 This is an example problem. You should read an FAQ to get start. First of all you haven't shown the type of main function :) output must be as this : cout <<(a+b); or: cout <<'a+b'; sorry for my English) |
|
|