We have been working very hard since 2009 to facilitate in your learning Read More. We can't keep up without your support. Donate Now.

www.vustudents.ning.com

 www.bit.ly/vucodes + Link For Assignments, GDBs & Online Quizzes Solution www.bit.ly/papersvu + Link For Past Papers, Solved MCQs, Short Notes & More

# cs201 first assignment complete solution due date 25-11-13

Do not copy this, try yourself. this is only for idea purpose. i added this in pdf and word format both.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

Views: 3317

Attachments:

### Replies to This Discussion

#include <iostream>
#include <conio.h>
using namespace std;

//www.virtualians.pk
main()
{
double f_temp, k_temp, c_temp, temp;
char ch, quit;
cout " ********************** www.vustudents.ning.com*****************"endl;
cout " ********************** Tariq Malik***********************"endl;
cout " *********** Temprature Conversion Calculator **************";
cout "\n\n Please enter the temprature unit for which you want the coverison ";
cout "\n 1. F for Fahrenheit to Celcius and Kalvin";
cout "\n 2. C for Celsius to Fahrenheit and Kalvin";
cout "\n 3. K for Kalvin to Fahrenheit and Celcius";
startagain:
cout "\n\n Please enter you choice: ";
cin >> ch;
switch(ch)
{
case 'f':
case 'F':
cout " Please enter temprature in Farhenheit: ";
cin >> f_temp;
c_temp = (f_temp - 32) * 5/9;
k_temp = (f_temp + 459.67) * 5/9;
cout " Celcius =" c_temp;
cout "\n Kelvin =" k_temp;
cout "\n Do you want to calculate another value (y/n): ";
cin >> quit;
if (quit == 'y' || quit == 'Y')
goto startagain;
break;
case 'c':
case 'C':
cout " Please enter temprature in Celcius: ";
cin >> c_temp;
k_temp = c_temp + 273.15 ;
f_temp = c_temp * 9/5 + 32;
cout " Kelvin =" k_temp;
cout "\n Farhenheit =" f_temp;
cout "\n Do you want to calculate another value (y/n): ";
cin >> quit;
if (quit == 'y' || quit == 'Y')
goto startagain;
break;
case 'k':
case 'K':
cout " Please enter temprature in Kelvin: ";
cin >> k_temp;
c_temp = k_temp - 273.15 ;
f_temp = (k_temp - 273.14) * 9/5 + 32;
cout " Celcius =" c_temp;
cout "\n Farhenheit =" f_temp;
cout "\n Do you want to calcute another value (y/n): ";
cin >> quit;
if (quit == 'y' || quit == 'Y')
goto startagain;
break;
default:
cout "\n Invalid Choice";
}
cout endlendl;
system("pause");
}

#include <iostream>

using namespace std;
int main()
{
double f_temp, k_temp, c_temp, temp;
char ch, quit;
cout " ********************** Zahid Anwar ***********************"endl;
cout " *********** Temprature Conversion Calculator **************";
cout "\n\n Please enter the temprature unit for which you want the coverison ";
cout "\n 1. F for Fahrenheit to Celcius and Kalvin";
cout "\n 2. C for Celsius to Fahrenheit and Kalvin";
cout "\n 3. K for Kalvin to Fahrenheit and Celcius";
startagain:
cout "\n\n Please enter you choice: ";
cin >> ch;
switch(ch)
{
case 'f':
case 'F':
cout " Please enter temprature in Farhenheit: ";
cin >> f_temp;
c_temp = (f_temp - 32) * 5/9;
k_temp = (f_temp + 459.67) * 5/9;
cout " Celcius =" c_temp;
cout "\n Kelvin =" k_temp;
cout "\n Do you want to calculate another value (y/n): ";
cin >> quit;
if (quit == 'y' || quit == 'Y')
goto startagain;
break;
case 'c':
case 'C':
cout " Please enter temprature in Celcius: ";
cin >> c_temp;
k_temp = c_temp + 273.15 ;
f_temp = c_temp * 9/5 + 32;
cout " Kelvin =" k_temp;
cout "\n Farhenheit =" f_temp;
cout "\n Do you want to calculate another value (y/n): ";
cin >> quit;
if (quit == 'y' || quit == 'Y')
goto startagain;
break;
case 'k':
case 'K':
cout " Please enter temprature in Kelvin: ";
cin >> k_temp;
c_temp = k_temp - 273.15 ;
f_temp = (k_temp - 273.14) * 9/5 + 32;
cout " Celcius =" c_temp;
cout "\n Farhenheit =" f_temp;
cout "\n Do you want to calcute another value (y/n): ";
cin >> quit;
if (quit == 'y' || quit == 'Y')
goto startagain;
break;
default:
cout "\n Invalid Choice";
}
cout endlendl;
return 0;

}

Cout k agay say (less than sign ) missing hay.. takreeban har statement mein..

cout " Kelvin =" k_temp;

iss trah ki statments mein inverted commas end pay ana hay na k pehlay.

Malik Tariq's ( Zahid Anwar) Solution

End wali line men endlendl dp dafa endl likha hay error ayga.

Dev-C++ software new version gives error in <iostream.h>

We have to use <iostream> instead of <iostream.h>

#include<conio.h>
#include<iostream>
using namespace std;

void function() //function for the menu
{
cout"enter the temperature unit for which you want the conversion ";
cout "\n 1. F for fahrenheit to celsius and kelvin";
cout"\n 2. C for celsius to fahrenheit and kelvin";
cout"\n 3. K for celsius and farenheit";
}
main()
{
char con;
char input;
do{ //do loop for repition
function();

cin>>input;
char con;

switch(input) //switch for different cases
{
case 'F':
case 'f':
cout"\nEnter temp in Fahrenheit";
float a1,b1,c1;
cin>>a1;
b1=(a1-32.0)/1.8;
cout"\ntemp in celsius is = "b1;
c1=(a1+459.67)*5/9;
cout"\ntemp in kelvin is = "c1;
break;
case 'C':
case 'c':
cout"\nEnter the temp in celsius ";
float a2,b2,c2;
cin>>a2;
b2=(a2*9/5)+32;
cout"\ntemp in F is = "b2;
c2=a2+273.15;
cout"\ntemp in kelvin is = "c2;
break;
case 'K':
case 'k':
cout"\nEnter the temp in kelvin ";
float a3,b3,c3;
cin>>a3;
b3=a3-273.15;
cout"\ntemp in celsius is = "b3;
c3=(a3-273.15)*1.8000+32.00;
cout"\ntemp in fahrenheit is = "c3;
break;
default:
cout"\nYou entered wrong option";
break;
}
cout"\ndo you want to continue(y/n)";
cin>>con;
if(con=='n'||con=='N')
return 0;
else
if(con=='y'||con=='Y')
main();

}while(1);
getche();
}

Complete and correct solution

//CS201 Introduction to Programming
// Assignment No. 01 Solution
// Fall 2013
//Virtual University
//Due Date: November 25, 2013
#include <iostream.h>
main()
{
double f_temp, k_temp, c_temp, temp;
char ch, quit;

cout " *********** Temprature Conversion Calculator **************";
cout "\n\n Please enter the temprature unit for which you want the coverison ";
cout "\n 1. F for Fahrenheit to Celcius and Kalvin";
cout "\n 2. C for Celsius to Fahrenheit and Kalvin";
cout "\n 3. K for Kalvin to Fahrenheit and Celcius";
startagain:

cout "\n\n Please enter you choice: ";
cin >> ch;

switch(ch)

case 'f':
case 'F':
cout " Please enter temprature in Farhenheit: ";
cin >> f_temp;
c_temp = (f_temp - 32) * 5/9;
k_temp = (f_temp + 459.67) * 5/9;
cout " Celcius =" c_temp;
cout "\n Kelvin =" k_temp;
cout "\n Do you want to calculate another value (y/n): ";
cin >> quit;
if (quit == 'y' || quit == 'Y')
goto startagain;
break;

case 'c':
case 'C':
cout " Please enter temprature in Celcius: ";
cin >> c_temp;
k_temp = c_temp + 273.15 ;
f_temp = c_temp * 9/5 + 32;
cout " Kelvin =" k_temp;
cout "\n Farhenheit =" f_temp;
cout "\n Do you want to calculate another value (y/n): ";
cin >> quit;
if (quit == 'y' || quit == 'Y')
goto startagain;
break;

case 'k':
case 'K':
cout " Please enter temprature in Kelvin: ";
cin >> k_temp;
c_temp = k_temp - 273.15 ;
f_temp = (k_temp - 273.14) * 9/5 + 32;
cout " Celcius =" c_temp;
cout "\n Farhenheit =" f_temp;
cout "\n Do you want to calcute another value (y/n): ";
cin >> quit;
if (quit == 'y' || quit == 'Y')
goto startagain;
break;

default:
cout "\n Invalid Choice";
}
cout endlendl;
system("pause");
}

Dev C++ Version 4.9.9.2

Sobia

http://vulms.vu.edu.pk/Library/library.aspx

ccp file kia ha plz tell

cpp means C Plus Plus. Cpp is a Programming language which is written in software (Dev C++)we write these code to make our program. and which file we use to write this code is called cpp file.

## Latest Activity

Kinz@ MuGhaL updated their profile
4 hours ago
Kinz@ MuGhaL joined +M.Tariq Malik's group

### SOC101 Introduction to Sociology

5 hours ago
Kinz@ MuGhaL joined +M.Tariq Malik's group

### PSY101 Introduction to Psychology

5 hours ago
Kinz@ MuGhaL joined +M.Tariq Malik's group

### PAK301 Pakistan Studies

5 hours ago
Kinz@ MuGhaL joined +M.Tariq Malik's group

### ENG501 History of English Language

5 hours ago
Muhammad Bilal replied to Imtiaz Waqar's discussion GDB No. 1 STA630 - Research Methods in the group STA630 Research Methods
5 hours ago
☆ Tina Solangi ☆ liked иαвєєℓ αнмє∂'s profile
6 hours ago
mahnoor omar, Maira Qurxam, Mr.Right and 24 more joined Virtual University of Pakistan
7 hours ago
8 hours ago
Hacker updated their profile
9 hours ago
Imtiaz Waqar added a discussion to the group STA630 Research Methods

### GDB No. 1 STA630 - Research Methods

11 hours ago
Imtiaz Waqar joined +M.Tariq Malik's group

11 hours ago

### MTH202 Discrete Mathematics

11 hours ago
11 hours ago
11 hours ago
Maria joined +M.Tariq Malik's group

### EDU101 Foundations of Education

11 hours ago
Maria and SafeerZaidi are now friends
11 hours ago
SafeerZaidi liked Maria's profile
12 hours ago
Tasha Malik posted a status
"Bio 201 Assignment # 2 Solution https://youtu.be/Gowjc67WZ4c"
13 hours ago
Maria liked +M.Tariq Malik's profile
13 hours ago