Dev C++ Cout Was Not Declared In This Scope

Posted By admin On 11.12.20

I have a C program: test.cpp #include int main char t = 'f'; char.t1; char.t2; coutcout was not declared in this sc. You should only really call a function like.cstr if you need to call a legacy C function. In this case atoi is a legacy C function but C has plenty of better options that you could use (actually the legacy C standard library has better options to use other than atoi).

  1. Dev C++ Cout Was Not Declared In This Scope Review
  2. Dev C++ Cout Was Not Declared In This Scope 2
P: 1
Here is the code.
#include <iostream>
main()
{
double f_temp, k_temp, c_temp, temp;
char ch, quit;
std::cout << ' *********** Temprature Conversion Calculator **************';
std::cout << 'nn Please enter the temprature unit for which you want the coverison ';
std::cout << 'n 1. F for Fahrenheit to Celcius and Kalvin';
std::cout << 'n 2. C for Celsius to Fahrenheit and Kalvin';
std::cout << 'n 3. K for Kalvin to Fahrenheit and Celcius';
startagain:
std::cout << 'nn Please enter you choice: ';
std::cin >> ch;
switch(ch)
{
case 'f':
case 'F':
std::cout << ' Please enter temprature in Farhenheit: ';
std::cin >> f_temp;
c_temp = (f_temp - 32) * 5/9;
k_temp = (f_temp + 459.67) * 5/9;
std::cout << ' Celcius =' << c_temp;
std::cout << 'n Kelvin =' << k_temp;
std::cout << 'n Do you want to calculate another value (y/n): ';
std::cin >> quit;
if (quit 'y' quit 'Y')
goto startagain;
break;
case 'c':
case 'C':
std::cout << ' Please enter temprature in Celcius: ';
std::cin >> c_temp;
k_temp = c_temp + 273.15 ;
f_temp = c_temp * 9/5 + 32;
std::cout << ' Kelvin =' << k_temp;
std::cout << 'n Farhenheit =' << f_temp;
std::cout << 'n Do you want to calculate another value (y/n): ';
std::cin >> quit;
if (quit 'y' quit 'Y')
goto startagain;
break;
case 'k':
case 'K':
std::cout << ' Please enter temprature in Kelvin: ';
std::cin >> k_temp;
c_temp = k_temp - 273.15 ;
f_temp = (k_temp - 273.14) * 9/5 + 32;
std::cout << ' Celcius =' << c_temp;
std::cout << 'n Farhenheit =' << f_temp;
std::cout << 'n Do you want to calcute another value (y/n): ';
std::cin >> quit;
if (quit 'y' quit 'Y')
goto startagain;
break;
default:
std::cout << 'n Invalid Choice';
}
std::cout << endl<<endl;
system('pause');
}

Dev C++ Cout Was Not Declared In This Scope Review

Hi guys,
I have a code in C++ that was written way back in 1995.Back then,I guess even in C++,#include<iostream.h> was used unlike nowadays, #include<iostream> using namespace std;...im rite now trying to compile that code with a g++ compiler.It gives the error at lots of places:'cout not declared in this scope'..I have tried using namespace std...but if I use that then errors sprout up in files that belong to C++ standard library...so I haven't been able to use using namespace std;....i have even tried using std::cout<<...<<std::endl...but even that is not working.....any ideas to get past this problem are appreciated.

Dev C++ Cout Was Not Declared In This Scope 2

Thanks....

  • 4 Contributors
  • forum 10 Replies
  • 7,109 Views
  • 1 Day Discussion Span
  • commentLatest Postby KAY111Latest Post

Ancient Dragon5,243

post one of the files that has the errors, especially the top of the *.cpp file where you have all the includes etc. The problem is most likely missing something like this:

or this Antares demo mac.

or like this:

Edited by Ancient Dragon: n/a