Error "source file not compiled"

1

I'm using Dev-C ++. I compile and when I go to run the message:

  

Uncompiled source file

What am I doing wrong?

#include <stdio.h>
main()
{
    float lado, area ;
    cout<< "digite o lado";
    cin>> lado;
    area= lado*lado;
    cout<< area;

  system("PAUSE");  
  return 0;
}
    
asked by anonymous 27.09.2015 / 01:16

1 answer

2

You are mixing C with C ++. The first thing to do is decide whether to program in one language or another. As it seems to be C ++, I'll try to hit it:

#include <iostream>
using namespace std;

int main() {
    float lado, area;
    cout << "digite o lado";
    cin >> lado;
    area = lado * lado;
    cout << area;
    return 0;
}

See running on ideone .

The changes I've made:

  • I put the right header, iostream that contains cin and cout . What you are using is C header.
  • I put using so I do not have to call the method by full name, so you do not have to use std::cin , for example.
  • And I have hit the type of the function main() that returns a int , so you have to type it.

Then, if you want, you can improve to make the output more presentable.

I gave one an organized code as well. Get used to doing this. It's important.

Fixing these things should compile. My compiled. I do not know in DEV C ++ because it is a pretty bad IDE.

    
27.09.2015 / 01:21