I want to make a program in which if I input A it should print that its a capital letter and if i input small a it should display small character , how can i write this?and also a program which inputs 4-5 numbers and prints the highest number and the lowest number?so any help ?
Lower or higher case ?
Started by ahmed, Oct 30 2008 07:41 AM
28 replies to this topic
#1
Posted 30 October 2008 - 07:41 AM
|
|
|
#2
Posted 30 October 2008 - 08:03 AM
Because a character is represented internally as an integer, you can test whether it is between 'a' and 'z' or between 'A' and 'Z'.
You have to go through the inputs and keep track of the current low/high number.
If you show us your code, we can help you further.
You have to go through the inputs and keep track of the current low/high number.
If you show us your code, we can help you further.
#3
Posted 30 October 2008 - 09:20 AM
ahmed said:
I want to make a program in which if I input A it should print that its a capital letter and if i input small a it should display small character , how can i write this?
ahmed said:
and also a program which inputs 4-5 numbers and prints the highest number and the lowest number?so any help ?
#4
Posted 30 October 2008 - 09:33 AM
is this correct ?
#include<conio.h>
#include<iostream.h>
#include<ctype.h>
void main()
{
char alphabet;
clrscr();
cout<<"\n Enter Alphabet : ";
cin>>alphabet;
if(alphabet==toupper(alphabet))
cout<<"\n It is CAPITAL";
else if(alphabet==tolower(alphabet))
cout<<"\n It is SMALL ";
getch();
}
#5
Posted 30 October 2008 - 10:16 AM
#include<conio.h>
#include<iostream.h>
#include<ctype.h>
int main()
{
char alphabet;
cout<<"\n Enter Alphabet : ";
cin>>alphabet;
if(alphabet==toupper(alphabet))
cout<<"\n It is CAPITAL";
else if(alphabet==tolower(alphabet))
cout<<"\n It is SMALL ";
return 0;
}
yes its true with a small fix
#6
Posted 30 October 2008 - 11:05 AM
Are you stuck learning on the ancient Turbo C++, ahmed?
#7
Posted 30 October 2008 - 02:29 PM
WingedPanther said:
Because a character is represented internally as an integer, you can test whether it is between 'a' and 'z' or between 'A' and 'Z'.
You have to go through the inputs and keep track of the current low/high number.
If you show us your code, we can help you further.
You have to go through the inputs and keep track of the current low/high number.
If you show us your code, we can help you further.
Wow this looks familiar...
#8
Guest_Jordan_*
Posted 30 October 2008 - 05:14 PM
Guest_Jordan_*
A link that may help if you want to compare the integer values (as Winged states): Ascii, Decimal, and Hexadecimal Conversion Chart
#9
Posted 30 October 2008 - 05:20 PM
I posted this method in his previous thread and was shot down for it. What's the difference in this case?
#10
Posted 30 October 2008 - 05:35 PM
I hadn't gotten around to it yet?
http://forum.codecal....html#post90057
http://forum.codecal....html#post90354
http://forum.codecal....html#post90057
http://forum.codecal....html#post90354
#11
Posted 30 October 2008 - 08:03 PM
I got this program working , yup i am using turbo C++ trying to get on visual c++ 6.0 , anyways how can i compare 4-5 numbers and get the largest and smallest?
#12
Posted 30 October 2008 - 08:54 PM
Use a for loop with two variables, one to hold the smallest, and one to hold the largest. Compare the input to them; if the input is smaller than the smallest, change the variable containing the smallest. If the input is larger than the largest, change the variable containing the largest.


Sign In
Create Account


Back to top









