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'); } |
|
I am trying to compile my program and I got an error: 'string' was not declared in this scope Even if I put in the file #include What is happing? May 31, 2017 Scope of Variables in C In general, the scope is defined as the extent up to which something can be worked with. In programming also the scope of a variable is defined as the extent of the program code within which the variable can we accessed or declared or worked with. Jun 28, 2011 For the best answers, search on this site You got to laugh at all the Obama supporters who counter a negative Michelle remark with Cindy’s drug use.
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.
Thanks........
- 4 Contributors
- forum 10 Replies
- 7,020 Views
- 1 Day Discussion Span
- commentLatest Postby KAY111Latest Post
Ancient Dragon5,243
Sleep Was Not Declared In This Scope Dev C++
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:
C++ Function Not Declared In Scope
or this
Was Not Declared In This Scope Dev C Youtube
or like this:
Edited by Ancient Dragon: n/a