You are mixing C with C++. The first thing to do is to decide whether to program in one language or the other. Since it looks like C++, I’ll try to get it right for her:
#include <iostream>
using namespace std;
int main() {
float lado;
cout << "digite o lado";
cin >> lado;
float area = lado * lado;
cout << area;
}
Behold working in the ideone. And in the repl it.. Also put on the Github for future reference.
The changes I’ve made:
- I put the right header, the
iostream
containing the cin
and cout
. What you’re using is C header.
- I put a
using
so you don’t have to call the method by its full name, so you don’t have to use std::cin
, for example.
- And I got the function guy
main()
that returns a int
, then you have to type her.
Then if you want you can improve for the output to be more presentable.
I gave one organized in the code too. Get used to doing this. It’s important.
Fixing these things should compile. Mine compiled. I don’t know in C++ DEV because it’s a pretty bad IDE.
When you have other problems and ask other questions, ask more details. This is a very simple case and I could see right away what was wrong, but in most cases if you don’t put everything you are using, describe what you are trying to do, give details, show the error that occurs, where, when, etc. the question will be closed because it is not clear, until you improve it.
– Maniero
Take a look at [tour]. You can accept an answer if it solved your problem. You can vote on every post on the site as well. Did any help you more? You need something to be improved?
– Maniero