c++ - error : binary '>>' : no operator found which takes a right-hand operand of type 'const char [1] -


mine simple c++ program calculate area of circle, error.can me? i'm new c++. here program:

#include "stdafx.h" #include <iostream> using namespace std;  int main() {     int area;     float r;     area = 3.14 * r * r;     cin >> "enter radius" >> r;     cout << "area of circle is:" << area;      return 0; } 

you can't read in literal "enter radius"; compiler telling you: it's attempting write first element of literal const char[1] type.

you need display message user via cout, when you're outputting area. read in radius using

cin >> r; 

you ought not evaluate area until r known.

(by way, definition of pi woeful float type: tend use atan(1)*4 pi; c++ standard library not define you.)


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -