We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More


Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

Assignment No. 02 Semester: Spring 2012 CS201: Introduction to Programming Total Marks: 20 Due Date:02/05/2012

Assignment No. 02
Semester: Spring 2012

CS201: Introduction to Programming

Total Marks: 20

 

Due Date:02/05/2012

 

Instructions:

Please read the following instructions carefully before submitting assignment. It should be clear that your assignment will not get any credit if:

 

  • The assignment is submitted after due date.
  • The submitted assignment does not open or file is corrupt.
  • Assignment is copied(partial or full) from any source (websites, forums, students, etc)

 

Note: You have to upload only .cpp file. Assignment in any other format (extension) will not be accepted and will be awarded with zero marks. For example, if you submit code in .doc (Word document) or .txt files, no reward will be given in any case.

 

 

Objective:

 

The objective of this assignment is to provide hands on experience of:

 

  • Functions
  • Array Manipulation

 

 

Guidelines:

 

  • Code should be properly indented and well commented.
  • Follow C/C++ rules while writing variable names, function names etc
  • Use only dev-C++ for this assignment.
  • Use appropriate C/C++ structure i.e. if-else; switch statement etc to get inputs from user where required (Marks will be deducted if inappropriate structure will be used)..

 

 

 

 

 

 

 

 

 

Assignment  

 

 

Problem Statement:    Temperature Calculation system    

 

Write a program that displays average, highest and lowest temperatures.

 

Detailed Description:

 

  • The program will take temperature readings as input from user for specified number of consecutive days.
  • Program will store these temperature values into an array.
  • Then it will pass this array to three different functions.
  • One function will return highest temperature, one will return lowest temperature and third one will return average temperature.
  • All these functions will be called inside main() function where these temperature results will be displayed to the user.

 

Sample Output:

 

Enter the number of consecutive days to read their temperature : 5

 

Enter temperature for day 1: 50

 

Enter temperature for day 2: 80

 

Enter temperature for day 3: 30

 

Enter temperature for day 4: 92

 

Enter temperature for day 5: 47

 

The average temperature is 59.80

The highest temperature is 92.00

The lowest temperature is 30.00  

 

 

 

NOTE:

The array containing temperature values must be passed to three different functions to return average, highest and lowest temperatures. Marks will be deducted if assignment is solved with some other technique.

 

 

+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 2733

.

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

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

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Attachments:

Replies to This Discussion

Please yar meri nayi assignment follow karo jo main ne abhi upload kyun ke us me comment bhi lekhin us mein zaror changes karna

CS201 Introduction to Programming Solution ( due Date 02.05.2012)

Problem Statement:    Temperature Calculation system    

Write a program that displays average, highest and lowest temperatures. 

Detailed Description: 

  • The program will take temperature readings as input from user for specified number of consecutive days.
  • Program will store these temperature values into an array.
  • Then it will pass this array to three different functions.
  • One function will return highest temperature, one will return lowest temperature and third one will return average temperature.
  • All these functions will be called inside main() function where these temperature results will be displayed to the user.

Sample Output: 

Enter the number of consecutive days to read their temperature : 5
Enter temperature for day 1: 50
Enter temperature for day 2: 80
Enter temperature for day 3: 30
Enter temperature for day 4: 92
Enter temperature for day 5: 47 

The average temperature is 59.80
The highest temperature is 92.00
The lowest temperature is 30.00
CS201 Solution 
CS201 solution 

s201 spring 2 assignment bt eyes 

Solution:

#include <cstdlib>
#include <iostream>
void high_Tenp(int [],int);
void low_Tenp(int []);
void Average_Tenp(int [],int);
using namespace std;
int main(int argc, char *argv[])
{
cout"\t\t***********************************"endl
"\t\t TEMPRATURE CALCULATION SYSTEM "endl
"\t\t***********************************"endle ndl;
int n;
cout"Enter the number of consecutive days to read theirtemperature : ";
cin>>n;
int x[n];
int i, j, tmp;
for(i=0;i<n;i++)
{
coutendl"Enter temperature for day "i+1" : ";
cin>>x[i];
}
for(i=0; i<n; i++)
{
for(j=0; j<n-1; j++)
{
if (x[j] > x[j+1])
{
tmp = x[j];
x[j] = x[j+1];
x[j+1] = tmp;
}
}
}
Average_Tenp(x,n);
high_Tenp(x,n);
low_Tenp(x);
system("pause");
}
void high_Tenp(int a[],int arraysize)
{
cout"The Higest Temprature is : "a[arraysize-1]endl;
}
void low_Tenp(int a[])
{
int b=0;
cout"The Lowest Temprature is : "a[b]endl;
}
void Average_Tenp(int a[],int arraysize)
{
int i;
double c=0;
for ( i = 0 ; i < arraysize ; i ++)
{
c=c+a[i];
}
c=c/i;
coutendl"The Average Temprature is : "cendl;
}
void swap(int *x, int *y) //function using pointers to interchange the values
{
int tmp;
if(*x > *y)
{
tmp = *x;
*x = *y;
*y = tmp;
}
}

CS201+Assignment#2+Solution

see the attached file please

Attachments:

#include<iostream.h>
#include<conio.h>
float avg(int [],int);
float low(int [],int);
float high(int [],int);

int main()
{
int n;
cout"Enter the number of consecutive days to read their temperature";
cin>>n;
coutendl;

int arr[10];
float l,h,a;
for(int i=0;i<n;i++)
{
cout"Enter the temperature for day "i+1" : ";
cin>>arr[i];
coutendl;
}
coutendl;
a=avg(arr,n);
cout"The Average Temperature is "aendl;
h=high(arr,n);
cout"The Highest temperature is "hendl;
l=low(arr,n);
cout"The Lowest temperature is "l;


getch();
}

float avg(int arr[],int n)
{
float sum=0.0,a;
for(int i=0;i<n;i++)
{
sum=sum+arr[i];

}
a=sum/5.0;
return (a);
}

float low(int arr[],int n)
{
float l=100.0;
for(int i=0;i<n;i++)
{
if(arr[i]<l)
l=arr[i];
}

return (l);
}
float high(int arr[],int n)
{
float h=0.0;
for(int i=0;i<n;i++)
{
if(arr[i]>h)
h=arr[i];


}

return (h);

}



RSS

© 2020   Created by +M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service

.