hello guys
i am new in this forum and in programing
i want to write a program which could convert given temperature and its unit into oher scales please give me some sugestions and ideas bout that
and i need to know how to declear chareters and how to take inputs of characters
Looking forward for yopur help
thanks
saqib.

Recommended Answers

All 10 Replies

please give me some sugestions and ideas bout that and i need to know how to declear chareters and how to take inputs of characters
saqib.

How about buying a C/C++ book, or taking a C/C++ class or reading a C/C++ tutorial?

With which part do you have problem? Formula for conversion or programming issue? For formulas, read this. For declaring char and inputting you got the answer from second post of this thread

Yeah post your effort here and then maybe we would be able to help you out, just asking for code here would not fetch much help.

> i want to write a program which could convert given temperature and its unit into oher scales
Start with centigrade to centigrade.

Very trivial conversion, but it at least gets you to attempt the first part of actually attempting the "prompt the user and get answers" part of the program.

Then we at least will know which part of the problem you're really stuck on and we can advise accordingly.

Are you trying to write this program in C or C++? Have you tried to write the program yet? Show us what you have so far.

1: #include <iostream.h>2:3: float Convert(float);4: int main()5: {6: float TempFer;7: float TempCel;8:9: cout << "Please enter the temperature in Fahrenheit: ";10: cin >> TempFer;11: TempCel = Convert(TempFer);12: cout << "\nHere's the temperature in Celsius: ";13: cout << TempCel << endl;14: }15:16: float Convert(float Fer)17: {18: float Cel;19: Cel = ((Fer - 32) * 5) / 9;20: return Cel;21: }You should get the same
I don't know, maybe this will help

in two weeks of learning c. ihave wrote the following programs
#include<stdio.h>
#include<math.h>
#include<conio.h>
void main(void)
{
int a_int,b_int,c_int,root1_int,root2_int;
printf("The Quadratic Equation\na*x*x+b*x+c=0\n");
printf("Value Of a_int\n");
scanf("%d",&a_int);
printf("Value Of b_int\n");
scanf("%d",&b_int);
printf("Value Of c_int");
scanf("%d",&c_int);
root1_int=(-b_int+sqrt(b_int*b_int-4*a_int*c_int))/(2*a_int);
printf("root1_int is%d\n",root1_int);
root2_int=-(b_int-sqrt(b_int*b_int-4*a_int*c_int))/(2*a_int);
printf("root2_int is%d\n",root2_int);
getche();
}
2
#include<stdio.h>
#include<conio.h>
void main(void)
{
int radius,volume,area;
printf("finding area and volume of a sphere);
printf("give the radius of sphere\n");
scanf("%d",&radius);
volume=(4/3)*3.14*radius*radius*radius;
printf("Volume Of Sphere is\n%d",volume);
area=4*3.14*radius*radius;
printf("\nArea Of Sphere is\n%d",area);
}
and some others
thanks for ur support now iam writing aprogramm which can find factorial but it is not working
#include<stdio.h>
void main(void)
{
int i,j,s,f,n;
printf("value of num");
scanf("%D",&n);
s=0;
{
for(i=1,i<=n,n++);
{
for(j=i,j>=1,j--);
}
s=i/f+s;
f=i;
}
printf("sum=%d"sum);
}
I am learning from book of Robert Lafore(Cprogramming Using Turbo C++)

the temperature program is runing now
#include<stdio.h>
#include<conio.h>
void main(void)
{
int kelvin,centigrade,fahrenheit;
printf("temperature in kelvin\n");
scanf("%d",&kelvin);
centigrade=kelvin-273;
printf("temperature in centigrade is\n%d,degree centigrades ",centigrade);
fahrenheit=(centigrade*9/5)+32;
printf("\ntemperature in fahrenheit is\n%d,degree fahrenheits ",fahrenheit);
getch();
}

Use code tags and don't use void main (read this)

Use code tags and don't use void main (read this)

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.