c++ coding

7 views
Skip to first unread message

mc120200982 Aqsa

unread,
Apr 26, 2012, 12:12:29 PM4/26/12
to virtaul-...@googlegroups.com
any one is here to check my codings plaz 
#include<iostream.h>
main()
{
int digit;
int number;
//Prompt the user for input
(cout<<"Please enter 5-digit number:";
cin>>number;
//Get the first digit and display it on screen
digit = number%10;
cout<<"The digits are:",";
cout<<digit<<:",";
//Get the remaining four digit number
number = number/1o;
//Get next digit and display it on screen
digit = number%10;
cout<<digit<<",";
//Get the remaining three digits number
number = number/10;
//Get the next digit and display it on screen
digit = number%10;
cout<<digit<<",";
//Get the remaining two digit number
number = number/10;
//Get the next digit and display it on screen
digit = number%10;
cout<<digit<<",";
//Get the remaining one digit number
number=number/10;
//Getthe next digit and display it on screen
digit = number%10;
cout<<digit;
}
 
 
 
 

bc110402493 Muhammad Farhan

unread,
Apr 27, 2012, 1:50:02 AM4/27/12
to virtaul-...@googlegroups.com
now check the difference between theas  two

#include<iostream.h>
main()
{
int digit;
int number;
//Prompt the user for input
cout<<"Please enter 5-digit number:";
cin>>number;
//Get the first digit and display it on screen
digit = number%10;
cout<<"The digits are:";

cout<<digit<<",";
//Get the remaining four digit number
number = number/10;

//Get next digit and display it on screen
digit = number%10;
cout<<digit<<",";
//Get the remaining three digits number
number = number/10;
//Get the next digit and display it on screen
digit = number%10;
cout<<digit<<",";
//Get the remaining two digit number
number = number/10;
//Get the next digit and display it on screen
digit = number%10;
cout<<digit<<",";
//Get the remaining one digit number
number=number/10;
//Getthe next digit and display it on screen
digit = number%10;
cout<<digit;
system("pause");
}

--
Contact Owner Id: zainal...@gmail.com
 
www.virtualinspire.com
 
If you want domain and web hosting. Also contact with me.
 
5000 per year with cpanel and domain name free with it.

mc120202659 Malik Waqas Ali Khan

unread,
Apr 27, 2012, 2:37:03 AM4/27/12
to virtaul-...@googlegroups.com
look like one brace is additional

On Thu, Apr 26, 2012 at 9:12 PM, mc120200982 Aqsa <mc120...@vu.edu.pk> wrote:

--
Contact Owner Id: zainal...@gmail.com
 
www.virtualinspire.com
 
If you want domain and web hosting. Also contact with me.
 
5000 per year with cpanel and domain name free with it.



--
MALIK WAQAS ALI KHAN
MIT, 1ST SEMESTER
ID: MC120202659

mc120200982 Aqsa

unread,
Apr 27, 2012, 2:25:48 PM4/27/12
to virtaul-...@googlegroups.com
Thanks Farhan

mc120200982 Aqsa

unread,
Apr 29, 2012, 1:48:39 AM4/29/12
to virtaul-...@googlegroups.com
i make this coding plaz check
#include<cstdlib>
#include<iostream>
void high_Tenp(int[],int);
void low_ten(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************************************"<<endl<<endl;
int n;
cout<<"Enter the number of consecutive days to read theritemperature:";
cin>>n;
int x[n];
int i,j,temp;
for(i=0;i<n;i++)
{
cout<<endl<<"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");
}
voidhigh_Tenp(inta[],intarraysize)
{
cout<<"The Higest Temprature is:"<<a[arraysiz-1]<<endl;
}
void low_Tenp(inta[])
{
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;
cout<<endl<<"The Average Tempure is:"<<c<<endl;
}
void swap(int*x,int*y)//function using pointers to interchange the values
{
int tmp;
if(*x>*y)
{
tmp = * x;
* x = * y;
* y = tmp;
}
}
 

mc120200030 Komal Shehzad

unread,
Apr 29, 2012, 6:47:46 AM4/29/12
to virtaul-...@googlegroups.com
bohat complex coding ha aqsa try to summarize it

mc120200030 Komal Shehzad

unread,
Apr 29, 2012, 6:48:44 AM4/29/12
to virtaul-...@googlegroups.com
and why you use swap machanizem

mc120200982 Aqsa

unread,
Apr 29, 2012, 8:05:30 AM4/29/12
to virtaul-...@googlegroups.com
jo samjh aya kr diya

mc120200357 Tariq Hanif

unread,
Apr 29, 2012, 9:45:07 AM4/29/12
to virtaul-...@googlegroups.com
On Sun, Apr 29, 2012 at 5:05 PM, mc120200982 Aqsa <mc120...@vu.edu.pk> wrote:
jo samjh aya kr diya

bohat achi try hai aqsa keep it up 
kam az kam muj se to bohat achi hain me to sara din office me guzaar k ghar chala jata hun



--
Regards

Tariq Hanif
MIT 1st Semester
Hasilpur & Sahiwal


mc120200982 Aqsa

unread,
Apr 29, 2012, 9:48:09 AM4/29/12
to virtaul-...@googlegroups.com
bt it's not correct ab submit kya karo gi??????????? tensssssssssss

mc120200982 Aqsa

unread,
Apr 29, 2012, 9:50:00 AM4/29/12
to virtaul-...@googlegroups.com
3,4 din ki menhat py pani phr gya

mc100400855 Naseer Ahmed Khan

unread,
Apr 29, 2012, 10:05:54 AM4/29/12
to virtaul-...@googlegroups.com
AOA

your section of code that i highlighted in red is OK but not efficient what if all the values are already sorted then still these nested loops will carry on their work so make a separate swap routine and declare a variable flag=0 if on comparison value is greater than the value ahead it (i guess you probably want values in increasing order) so when a comparison is made then set the flag=1 that mean you need another outer loop iteration That is why the wise men created a bubblesort algo.
hope you didn't take it to heart just take it to mind sis.
regards
On Sun, Apr 29, 2012 at 10:48 AM, mc120200982 Aqsa <mc120...@vu.edu.pk> wrote:

mc120200982 Aqsa

unread,
Apr 29, 2012, 1:40:03 PM4/29/12
to virtaul-...@googlegroups.com
Thanks a lot Naseer bro you help me is main mind karyn ki kya bat hy agr mind karna hota to mail kyu karti

mc110403389 Haroon Shahzad

unread,
Apr 29, 2012, 3:12:15 PM4/29/12
to virtaul-...@googlegroups.com

cs201 ki coading notepad ma likhni hai kia
 

mc100200093 Tariq Saeed

unread,
Apr 30, 2012, 12:18:03 AM4/30/12
to virtaul-...@googlegroups.com
Kindly send the solution of assignment of CS201 to me thanks s

mc120200982 Aqsa

unread,
Apr 30, 2012, 4:08:12 AM4/30/12
to virtaul-...@googlegroups.com
jis py dil kary likh lo 

On Mon, Apr 30, 2012 at 12:12 AM, mc110403389 Haroon Shahzad <mc110...@vu.edu.pk> wrote:

cs201 ki coading notepad ma likhni hai kia
 

--

mc110402308 Irfan Ullah

unread,
Apr 30, 2012, 4:10:02 AM4/30/12
to virtaul-...@googlegroups.com
no dev cpp main leko

On Mon, Apr 30, 2012 at 12:12 AM, mc110403389 Haroon Shahzad <mc110...@vu.edu.pk> wrote:

cs201 ki coading notepad ma likhni hai kia
 

--
Reply all
Reply to author
Forward
0 new messages