473,388 Members | 1,209 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,388 software developers and data experts.

plz help to solve some problem

I am a newcommer in c world,
I am making a tiny program on Mathematics.
I have one problem if somebody enter his name, "i am able to make the
first letter uppercase but my problem how can i make the 1st letter
after space to be uppercase" plz help me.
Then "how can i get the value of Sin30 degree".
And how can I draw a Triangle or a rectangle shape.

Nov 14 '05 #1
16 1461
Fahad wrote:
I am a newcommer in c world,
I am making a tiny program on Mathematics.
I have one problem if somebody enter his name, "i am able to make the
first letter uppercase but my problem how can i make the 1st letter
after space to be uppercase" plz help me.
Then "how can i get the value of Sin30 degree".
And how can I draw a Triangle or a rectangle shape.


First, C does not have strings.
Second, you want a formula or equation to help you derive Sin30 degrees.
Third, C does not have pen and paper.

I hope that helped.
(PS: Read your C book)
Nov 14 '05 #2
"Fahad" writes:
Then "how can i get the value of Sin30 degree".


The sin() function in <math.h> will give you the answer in radians. Use
that function and then convert to degrees in your program. You will
probably get better results if you post one question per post. Otherwise,
people get the wrong impression about what you are up to.
Nov 14 '05 #3
In article <3f************@individual.net>,
osmium <r1********@comcast.net> wrote:
The sin() function in <math.h> will give you the answer in radians. Use
that function and then convert to degrees in your program.


Urrr -- that's the description for asin(), not for sin().

--
Usenet is like a slice of lemon, wrapped around a large gold brick.
Nov 14 '05 #4
On Fri, 27 May 2005 21:18:40 +1000, Arafangion wrote:
Fahad wrote:
I am a newcommer in c world,
I am making a tiny program on Mathematics.
I have one problem if somebody enter his name, "i am able to make the
first letter uppercase but my problem how can i make the 1st letter
after space to be uppercase" plz help me.
Then "how can i get the value of Sin30 degree".
And how can I draw a Triangle or a rectangle shape.

First, C does not have strings.


Sure it does. However C defines them as a data format rather than a
data type. C (roughly) defines a string as a sequence of characters
terminated by a null character
Second, you want a formula or equation to help you derive Sin30 degrees.


Or use the sin() function. The only reall issue is that it takes a value
in raqdians rather then degrees. Just remember that there are 2 PI radians
(think of the formula of a circle's circumference from its radius) in a
full circle i.e. 360 degrees.

Lawrence
Nov 14 '05 #5
Arafangion <Ar********@invalid.email.address.com> writes:
Fahad wrote: [...]
I have one problem if somebody enter his name, "i am able to make the
first letter uppercase but my problem how can i make the 1st letter
after space to be uppercase" plz help me.

[...]
First, C does not have strings.


Of course it does, though C strings aren't first-class objects as they
are in some other languages.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #6
"osmium" <r1********@comcast.net> writes:
"Fahad" writes:
Then "how can i get the value of Sin30 degree".


The sin() function in <math.h> will give you the answer in radians. Use
that function and then convert to degrees in your program. You will
probably get better results if you post one question per post. Otherwise,
people get the wrong impression about what you are up to.


The sin() function takes an argument in radians. If you have an
argument in degress, you need to convert it to radians before calling
sin().

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #7
Keith Thompson wrote:

Arafangion <Ar********@invalid.email.address.com> writes:
Fahad wrote:

[...]
I have one problem if somebody enter his name,
"i am able to make the
first letter uppercase but my problem how can i make the 1st letter
after space to be uppercase" plz help me.

[...]

First, C does not have strings.


Of course it does, though C strings aren't first-class objects as they
are in some other languages.


Strings aren't objects at all.
Every byte of a string is the begining of a string.
An object may contain several distinct strings.
A string may span two unrelated objects.

--
pete
Nov 14 '05 #8
pete <pf*****@mindspring.com> writes:
Keith Thompson wrote:

Arafangion <Ar********@invalid.email.address.com> writes:
> Fahad wrote: [...]
>> I have one problem if somebody enter his name,
>> "i am able to make the
>> first letter uppercase but my problem how can i make the 1st letter
>> after space to be uppercase" plz help me.

[...]
>
> First, C does not have strings.


Of course it does, though C strings aren't first-class objects as they
are in some other languages.


Strings aren't objects at all.


Sure they are. A string is "a contiguous sequence of characters
terminated by and including the first null character". An object is a
"region of data storage in the execution environment, the contents of
which can represent values".
Every byte of a string is the begining of a string.
Yes.
An object may contain several distinct strings.
Yes.
A string may span two unrelated objects.


Only if the objects are subobjects of an enclosing object; otherwise
any attempt to treat parts of two unrelated objects as a string must
invoke undefined behavior.

Objects can overlap.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #9
Keith Thompson wrote:
A string may span two unrelated objects.


Only if the objects are subobjects of an enclosing object; otherwise
any attempt to treat parts of two unrelated objects as a string must
invoke undefined behavior.


You're making that up.
If two unrelated objects can be determined to be contiguous
and if only the higher addressed object has a null byte,
then there are no words in the standard
which exempt a standard library string output function, like puts,
from working with an argument that points to the lower addressed object.

If puts can't incremenent a pointer through the string without
invoking undefined behavior, then it's up to puts to find another way.

/* BEGIN new.c */

#include <stdio.h>

#define HELLO "Hello "

int main(void)
{
char hello[sizeof HELLO - 1] = HELLO;
char world[] = "world";

if (world == hello + sizeof hello) {
puts(hello);
/* puts("wow"); */
} else {
puts("Hello world");
}
return 0;
}

/* END new.c */
--
pete
Nov 14 '05 #10
pete wrote:

Keith Thompson wrote:
A string may span two unrelated objects.


Only if the objects are subobjects of an enclosing object; otherwise
any attempt to treat parts of two unrelated objects as a string must
invoke undefined behavior.


You're making that up.


I think I'm going to change my tune on this one.
The string functions in the library are said to be intended
to work with arrays and objects.

Then I'll say instead that there are no string types.

--
pete
Nov 14 '05 #11
On Sat, 28 May 2005 10:40:35 +0000, pete wrote:
Keith Thompson wrote:
> A string may span two unrelated objects.
Only if the objects are subobjects of an enclosing object; otherwise
any attempt to treat parts of two unrelated objects as a string must
invoke undefined behavior.


You're making that up.
If two unrelated objects can be determined to be contiguous


Then you have established a relation between them so they aren't
unrelated.

and if only the higher addressed object has a null byte,
then there are no words in the standard
which exempt a standard library string output function, like puts,
from working with an argument that points to the lower addressed object.
The rules of pointer arithmetic in normal code do not allow access of
array elements beyond the array size. As such a string as C defines it
MUST have a null character within the original array object. If you
violate this requirement when calling a standard library function that
stipulatesa pointer to a string then you invoke undefined behaviour.
If puts can't incremenent a pointer through the string without invoking
undefined behavior, then it's up to puts to find another way.
No, you have violated puts()'s call requirements by not passing it a valid
string.
/* BEGIN new.c */

#include <stdio.h>

#define HELLO "Hello "

int main(void)
{
char hello[sizeof HELLO - 1] = HELLO; char world[] = "world";

if (world == hello + sizeof hello) {
Consider that even though the 2 pointer values ``world'' and
``hello + sizeof hello'' may compare equal they need not be the same
pointers. For example they may contain segment/boundary information which
is not used in the comparison. It simply may not be possible to access any
data in world from a pointer to hello (e.g. the system would trap from
such an access). This might make it clearer why a pointer to a character
in hello is not a valid pointer to a string, even at this point in the
code.
puts(hello);
/* puts("wow"); */
} else {
puts("Hello world");
}
return 0;
}
}
/* END new.c */


Lawrence

Nov 14 '05 #12
pete <pf*****@mindspring.com> writes:
Keith Thompson wrote:
> A string may span two unrelated objects.
Only if the objects are subobjects of an enclosing object; otherwise
any attempt to treat parts of two unrelated objects as a string must
invoke undefined behavior.


You're making that up.


I resent that.
If two unrelated objects can be determined to be contiguous
and if only the higher addressed object has a null byte,
then there are no words in the standard
which exempt a standard library string output function, like puts,
from working with an argument that points to the lower addressed object.


I believe you're right. I forgot that the standard allows for the
possibility of two objects being detectably adjacent (it has to in
order for pointer comparison to work properly). But in that case I'd
say that the two (or more) object can be treated as a single object,
given the standard's definition of the term. (And, of course, as
Lawrence Kirby points out, the objects are then no longer unrelated.)

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #13
Keith Thompson wrote:

pete <pf*****@mindspring.com> writes:
Keith Thompson wrote:
> A string may span two unrelated objects.

Only if the objects are subobjects
of an enclosing object; otherwise
any attempt to treat parts of two unrelated
objects as a string must
invoke undefined behavior.


You're making that up.


I resent that.


Sorry.

--
pete
Nov 14 '05 #14
pete <pf*****@mindspring.com> writes:
Keith Thompson wrote:
pete <pf*****@mindspring.com> writes: [...]
> You're making that up.


I resent that.


Sorry.


S'awright, forget it.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #15
Keith Thompson wrote:

pete <pf*****@mindspring.com> writes:
Keith Thompson wrote:

Arafangion <Ar********@invalid.email.address.com> writes:
> Fahad wrote:
[...]
>> I have one problem if somebody enter his name,
>> "i am able to make the
>> first letter uppercase but my problem how can i make the 1st letter
>> after space to be uppercase" plz help me.
[...]
>
> First, C does not have strings.

Of course it does,
though C strings aren't first-class objects as they
are in some other languages.


Strings aren't objects at all.


Sure they are.


Then what's a first-class object?

--
pete
Nov 14 '05 #16
pete <pf*****@mindspring.com> writes:
Keith Thompson wrote:
pete <pf*****@mindspring.com> writes:
> Keith Thompson wrote:
>>
>> Arafangion <Ar********@invalid.email.address.com> writes:
>> > Fahad wrote:
>> [...]
>> >> I have one problem if somebody enter his name,
>> >> "i am able to make the
>> >> first letter uppercase but my problem how can i make the 1st letter
>> >> after space to be uppercase" plz help me.
>> [...]
>> >
>> > First, C does not have strings.
>>
>> Of course it does,
>> though C strings aren't first-class objects as they
>> are in some other languages.
>
> Strings aren't objects at all.


Sure they are.


Then what's a first-class object?


It's a rather vaguely defined concept, depending on the operations
supported on a given type.

C scalar objects, for example, are considered first-class because they
support assignment, comparison, passing as parameters, etc. Arrays
aren't, because they don't. Structures support assignment but not
comparison; whether they're "first-class" is probably a judgement
call.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: BVM | last post by:
Hi, All: I have this error. It seems execution time is too long. Actually the execution time is about 30 seconds(I tested in Query analyzer). How do I solve this problem? ...
3
by: Alex | last post by:
Hi, I have a problem involving some design issue. I have two unrelated (that is, they do not derive from the same base) classes: ClassA ClassB Both have a quite similar interface, so they can...
7
by: Shapper | last post by:
Hello, I have an ASP:ImageButton where I want to call a function and pass a string: OnClick="Change_Photo("John")" I am having problems with "". I tried
6
by: Federico | last post by:
Hi, this is what I can do: - Create new solutions using VS.Net ASP.Net - Save the solutions, build the solution, view in browser with the solution still open. But, once I close the solution, I...
0
by: Jitesh | last post by:
I am facing a problem in webservice, I want to know what will be the exact procedure to solve the problem............. What I want to do............ I have a table named order in SQL Server....
27
by: John Salerno | last post by:
Ok, here's a problem I've sort of assigned to myself for fun, but it's turning out to be quite a pain to wrap my mind around. It's from a puzzle game. It will help if you look at this image: ...
8
by: vj | last post by:
Hi all, I want to solve the two equations u*tan(u)=w and u^2 + w^2=V^2, where V is a known constant, and u and w are the two unknowns to be determined. Please can someone suggest me how to...
1
by: arun | last post by:
Query is too complex -------------------------------------------------------------------------------- Hi, I was trying to solve this problem since last two days but couldn't find any solution. ...
17
by: Michael Reichenbach | last post by:
Here is the example code. int main(int argc, char *argv) { string Result; WIN32_FIND_DATA daten; HANDLE h = FindFirstFile(TEXT("c://test"), &daten); system("PAUSE"); return EXIT_SUCCESS; }
2
by: itsvineeth209 | last post by:
My task is to create login control without using login control in tools. I shouldnt use sqldatasource or any other. I should use only data sets, data adapters and data readers etc. U had created...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.