Submission #142526


Source Code Expand

#include <iostream>
#include <sstream>

using namespace std;
int main()
{

	double dist;
	stringstream vv;
	cin >> dist;

	dist = dist/1000;

	if (dist < 0.1)
	{
		vv="00";
	}else if(1 > dist > 0.1){
  		vv << "0" << 10*dist; 
	}else if(5 > dist > 1){
  		vv = 10*dist; 
		//vv= 10*dist;
	}else if(30 > dist > 5){
		vv= dist+50;
	}else if(5 > dist > 0.1){
		vv= ((dist-30)/5)+80;
	}else{
		vv= "89";
	}

	std::cout << vv << endl;

	return 0;



}

Submission Info

Submission Time
Task B - 視程の通報
User smochi18
Language C++ (G++ 4.6.4)
Score 0
Code Size 481 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:16:6: error: no match for ‘operator=’ in ‘vv = "00"’
./Main.cpp:16:6: note: candidate is:
/usr/include/c++/4.6/sstream:483:11: note: std::basic_stringstream<char>& std::basic_stringstream<char>::operator=(const std::basic_stringstream<char>&)
/usr/include/c++/4.6/sstream:483:11: note:   no known conversion for argument 1 from ‘const char [3]’ to ‘const std::basic_stringstream<char>&’
./Main.cpp:20:13: error: no match for ‘operator=’ in ‘vv = (dist * 1.0e+1)’
./Main.cpp:20:13: note: candidate is:
/usr/include/c++/4.6/sstream:483:11: note: std::basic_stringstream<char>& std::basic_stringstream<char>::operator=(const std::basic_stringstream<char>&)
/usr/include/c++/4.6/sstream:483:11: note:   no known conversion for argument 1 from ‘double’ to ‘const std::basic_stringstream<char>&’
./Main.cpp:23:12: error: no match for ‘operator=’ in ‘vv = (dist + 5.0e+1)’
./Main.cpp:23:12: note: candidate is:
/usr/include/c++/4.6/sstrea...