473,387 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

changing a character to integers

helo everyone may i someone please help me i'm doing a survey program where i'm calculating males,female and people where gender doesnt matter so my problem is i'm using characte m-male,f-female and h-hhetrosexual so how can i change them to integers.a little help will be appreciated
May 20 '07 #1
4 1711
weaknessforcats
9,208 Expert Mod 8TB
Maybe:

1 = male
2 = female
etc...
May 20 '07 #2
Maybe:

1 = male
2 = female
etc...
i've tried already but i don't get what the program wants.

i'm using a for loop where a total of hundred people were doing a survey and decided to complete a questionnaire which include highest grade,age and gender so i've tried to come with a formular to calculate the number of males their age and highest grade but i failed
May 20 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
Now it appears you have an algorithm problem and not a character-to-integer conversion problem.

Have you done the calculation you want on paper with a pencil and gotten the correct answer?? If you can't do that, then no amount of looping will get you the result you want.

You have to know your algorithm before you start coding.
May 20 '07 #4
Savage
1,764 Expert 1GB
helo everyone may i someone please help me i'm doing a survey program where i'm calculating males,female and people where gender doesnt matter so my problem is i'm using characte m-male,f-female and h-hhetrosexual so how can i change them to integers.a little help will be appreciated
I'm just little curios.

Why do u want to convert char to int?

Savage
May 20 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Z | last post by:
I have sub-classed the TextBox. In its OnKeyDown event I can intercept key strokes, examine them, etc. When I get a certain keycode (e.g., 'A') I want to change it to another unicode key from a...
1
by: rusttree | last post by:
I'm working on a program that manipulates bmp files. I know the offset location of each piece of relevent data within the bmp file. For example, I know the 18th through 21st byte is an integer...
4
by: Pokerkook | last post by:
Hello, If anybody could help me with this I would greatly appreciate it. Or at least tell me why I get the output of this garbage: 49 49 10 49 52
20
by: adityavasishth | last post by:
hi all, Characters are basically implemented via integers,ex : '\0' is 0.But integers requires 2 bytes and the characters require only 1 byte.So,can anybody please tell me that how the...
8
by: Dawn Minnis | last post by:
Hey guys If I have a program (see codeSnippet1) that I compile to be called test.o Then run it as test.o n n 2 3 4 I want the code to be able to strip out the two characters at the start...
44
by: Kulgan | last post by:
Hi I am struggling to find definitive information on how IE 5.5, 6 and 7 handle character input (I am happy with the display of text). I have two main questions: 1. Does IE automaticall...
14
by: mast2as | last post by:
Hi everyone, I am trying to implement some specs which specify that an array of parameter is passed to a function as a pointer to an array terminated by a NULL chatacter. That seemed fairly easy...
13
by: Anna | last post by:
I try to put 8 int bit for example 10100010 into one character of type char(1 octet) with no hope . Could anyone propose a simple way to do it? Thank you very much.
3
by: john | last post by:
I have a simple module which performs basic operations on plot3d files (below). I wrapped like: f2py --fcompiler=gfortran -m plot3d -c prec.f90 plot3d.f90 That seems to work fine, but i get...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.