I want to know how to set the tab settings in C programs. When every i use tab it makes 8 spaces in user screen. Now i am using it to make 5 spaces by using space in for loop under a if condition.
Can anyone please help me.
How to set the tab settings.?
This is actually a tough question. So, when your program prompts for user input, and the user hits the tab key, you get 8 spaces. Yes, this is totally separate from any editor, and may be independent of enviroment variables. I might suggest rethinking your program to get around this problem. Can you read keystrokes instead, and echo output to the screen? If so, you can control how many spaces to spit out for a tab.
Reply:That has nothing to do with the C language. It's an editor setting. If you are using an IDE there should be an options setting that you can configure. If you are using a text editor, it would depend on the editor. What editor are you using?
[edit, additional details]
Still, it has nothing to do with C. When you output a TAB character it's a single ASCII byte that is inserted into an output stream using the "\t" format option or just inserting a 0x09 (ASCII tab). That's as much control as you have in "C". Ask yourself this: how does a single byte (0x09) get turned into 8 spaces (versus 1 or 5 or 8) when read back and displayed on the screen? Answer: it depends on how the software that reads the tab interprets and decides display it. Even if what you are talking about is a character string written to a device, every device - weather that device is a simulted one in a windows environment, an old PC text screen, or a really old ASCII CRT terminal - has software behind it that governs how ASCII codes are interpreted and generated the on the screen. When that software encounters TAB character it's interpreted in a specific way: If the font used is fixed width, it tells the software to convert the TAB into a specific (and configurable) number of spaces. If the font used is variable width, it typically tells the software to move the cursor over to a specific (and configurable) position on the screen before generating the next displayable character. Neither of these are configurable from within 'C', they are only configurable from within the software that is interpreting the TAB character.
I might be able to help more if you provide some more details about your application, including the hardware and system environment.
Monday, May 24, 2010
Which of these sets of points are the corner points...pick a,b,c, or d?
Which of these sets of points are the corner points for the feasible region satisfying the system of linear inequalities 2x + 8y %26lt; or = 32, 5x + 2y %26gt; or = 30, x%26gt; or =0, y %26gt; or =0?
a) (5,9), (4,0), (1/2, 4/9)
b) (0,4), (15, 0), (0, 0)
c) (0,4), (0,15), (4, 0), (4, 9)
d) (0, 4), (0, 15), (44/9, 25/9)
Which of these sets of points are the corner points...pick a,b,c, or d?
Are you sure the inequalities aren't 2x+8y %26gt;= 32 and 5x+2y%26lt;=30? This would lead to answer d. But they problem you stated (2x+8y %26lt;= 32 and 5x+2y%26gt;=30) leads to another answer not listed: (6,0), (16,0), and (44/9, 25/9).
Assuming the inequalities are 2x+8y %26gt;= 32 and 5x+2y%26lt;=30 we can show that:
y%26gt;= 4-x/4 and y%26lt;=15-5x/2
So at x = 0, y must be between 4 and 15.
Setting the two equations equal yields a third corner point:
4-x/4 = 15-5x/2
which is true at x=44/9. Plugging this x value into either equation above yields y = 25/9.
Reply:Go with R. J.
magnolia
a) (5,9), (4,0), (1/2, 4/9)
b) (0,4), (15, 0), (0, 0)
c) (0,4), (0,15), (4, 0), (4, 9)
d) (0, 4), (0, 15), (44/9, 25/9)
Which of these sets of points are the corner points...pick a,b,c, or d?
Are you sure the inequalities aren't 2x+8y %26gt;= 32 and 5x+2y%26lt;=30? This would lead to answer d. But they problem you stated (2x+8y %26lt;= 32 and 5x+2y%26gt;=30) leads to another answer not listed: (6,0), (16,0), and (44/9, 25/9).
Assuming the inequalities are 2x+8y %26gt;= 32 and 5x+2y%26lt;=30 we can show that:
y%26gt;= 4-x/4 and y%26lt;=15-5x/2
So at x = 0, y must be between 4 and 15.
Setting the two equations equal yields a third corner point:
4-x/4 = 15-5x/2
which is true at x=44/9. Plugging this x value into either equation above yields y = 25/9.
Reply:Go with R. J.
magnolia
How do I install a 2nd HD and set it to slave?
I am running Windows XP Professional with service pack 2 on an AMD 1200+, 128 MB RAM, With a 120GB HD.
The HD is partioned with the letters C and D, C being for windows and system at 4GB and D being for everything else.
CD RW drive E is set as Primary master and C as Secondary master.
As the space on the partition for XP is so small I regularly experience problems, such as not being able to use the Internet to watch video or the computer just refuses to work.
I want to install a 40GB drive that was used for Win98SE as a slave and reformat it, then put XP and all my settings onto that to try to solve the problem. I have tried connecting it to the slave on the same ribbon as the HD and to another slot. But the BIOS will not recognise it either way. Also how do I assign letters to the drives?
I can't find any jumper cables on the Motherboard nor do I know where they go.
Help Please!
How do I install a 2nd HD and set it to slave?
on the back of the drive will be two little spots with a tiny "jumper" in it.. One says master the other one says slave.. carefully remove the jumper and replace it in the slave spot then connect the hard drive in the computer..Good luck..
Reply:their is these jumpers on the hd that has to be placed on "Slave" and "master" for the master HD then you can use the same ribbon as the first hd and then plug in the small power cable and then the four wire access cable and then formatt the new HD by jumping into the msdos settings and adding the slave into the registry.OR just take it to the GEEK you know?
Reply:Get Partition Magic and repartition your 120 Gb Hard Drive ie make your Primary Partition as big as you like.
you can install it on D: and the program is graphical and fairly simple to use.
Reply:either A) remove both jumpers or B) switch the jumpers to cable select on both drives, make sure the drive you want to be the master is on the end of the cable and the slave is on second slot. the sys will figure it out, shouludnt have to mess with jumpers too much.
as far setting the sys up the way you have described, you may want to load the 40g by itsself, remove the 120g all together, load win xp. after you load the os put the 120g back on the cable, second slot, and it should load(you may not be able to access the original C partition, but you should get to the D partition, which im assuming is the data you want, without a problem)
at this point, if you have the space, move the data from the 120 to the 40 into a temp folder, reformat the 120 without an OS, transfer data back to 120. now you have 40g for your OS and a full 120 for your data.
to reassign drive letters and have far more (reliable) control over your partitions and format options get partition magic
http://www.symantec.com/home_homeoffice/...
considering you really dont use it much it is kinda expensive, but the few times you DO use it youll love it.
hope that helps =)
Reply:As long as it is IDE there should be jumper pins on the back of it. Your 40GB hard-drive is probably set to Master also that's why your Bios does not recognize it (there are 2 masters). Google the Manufacturer and model number of the Hard Drive and you with the term "Jumper Pin Settings". You should be able to figure it out from there in 10 minutes.
Reply:if you have set your BIOS and its not going to work then check Jumper Setting in your HardDisk .. in harddisk you wil see information regarding Jumper Settings ...follow that ..
Reply:To make it a slave look behind the harddrive there should be a place that you insert a clip to set it to slave or master. If it is clearly labeled it is just a matter of switching the clip.
Reply:I don't see where you mentioned that you jumpered the drives appropriately so that may be where you are going wrong.
You will need to set the primary drive (be it optical or hdd) to master. Important to note here that some drives have two different master settings, i.e. single master and master with slave setting. The slave drive will also need to be jumpered as a slave.
Most of the time the settings for the jumpers are printed on the hard drive so it is usually no trouble to set them.
As for assigning drive letters, you can do this in Windows XP by clicking Start-%26gt;Run and then type diskmgmt.msc in the run box and click ok or hit enter. This brings up the disk manager which allows you to specify drive letters as well as several other things like creating partitions and formatting.
Reply:When you install and set the second drive to slave, be sure you set the primary drive to master. This is not necessary on all makes, but WD requires it.
Reply:change the jumper setting
Reply:look on the back of the hard drive...u should see some small pins with a little black clip(jumper)..u can move the clip (jumper) from one to other..master or slave....once u do that and install hd..u will have to turn pc on..go to my computer..right click on the hard drtive and select ....format
if not..check this out
http://www.google.com.au/search?sourceid...
The HD is partioned with the letters C and D, C being for windows and system at 4GB and D being for everything else.
CD RW drive E is set as Primary master and C as Secondary master.
As the space on the partition for XP is so small I regularly experience problems, such as not being able to use the Internet to watch video or the computer just refuses to work.
I want to install a 40GB drive that was used for Win98SE as a slave and reformat it, then put XP and all my settings onto that to try to solve the problem. I have tried connecting it to the slave on the same ribbon as the HD and to another slot. But the BIOS will not recognise it either way. Also how do I assign letters to the drives?
I can't find any jumper cables on the Motherboard nor do I know where they go.
Help Please!
How do I install a 2nd HD and set it to slave?
on the back of the drive will be two little spots with a tiny "jumper" in it.. One says master the other one says slave.. carefully remove the jumper and replace it in the slave spot then connect the hard drive in the computer..Good luck..
Reply:their is these jumpers on the hd that has to be placed on "Slave" and "master" for the master HD then you can use the same ribbon as the first hd and then plug in the small power cable and then the four wire access cable and then formatt the new HD by jumping into the msdos settings and adding the slave into the registry.OR just take it to the GEEK you know?
Reply:Get Partition Magic and repartition your 120 Gb Hard Drive ie make your Primary Partition as big as you like.
you can install it on D: and the program is graphical and fairly simple to use.
Reply:either A) remove both jumpers or B) switch the jumpers to cable select on both drives, make sure the drive you want to be the master is on the end of the cable and the slave is on second slot. the sys will figure it out, shouludnt have to mess with jumpers too much.
as far setting the sys up the way you have described, you may want to load the 40g by itsself, remove the 120g all together, load win xp. after you load the os put the 120g back on the cable, second slot, and it should load(you may not be able to access the original C partition, but you should get to the D partition, which im assuming is the data you want, without a problem)
at this point, if you have the space, move the data from the 120 to the 40 into a temp folder, reformat the 120 without an OS, transfer data back to 120. now you have 40g for your OS and a full 120 for your data.
to reassign drive letters and have far more (reliable) control over your partitions and format options get partition magic
http://www.symantec.com/home_homeoffice/...
considering you really dont use it much it is kinda expensive, but the few times you DO use it youll love it.
hope that helps =)
Reply:As long as it is IDE there should be jumper pins on the back of it. Your 40GB hard-drive is probably set to Master also that's why your Bios does not recognize it (there are 2 masters). Google the Manufacturer and model number of the Hard Drive and you with the term "Jumper Pin Settings". You should be able to figure it out from there in 10 minutes.
Reply:if you have set your BIOS and its not going to work then check Jumper Setting in your HardDisk .. in harddisk you wil see information regarding Jumper Settings ...follow that ..
Reply:To make it a slave look behind the harddrive there should be a place that you insert a clip to set it to slave or master. If it is clearly labeled it is just a matter of switching the clip.
Reply:I don't see where you mentioned that you jumpered the drives appropriately so that may be where you are going wrong.
You will need to set the primary drive (be it optical or hdd) to master. Important to note here that some drives have two different master settings, i.e. single master and master with slave setting. The slave drive will also need to be jumpered as a slave.
Most of the time the settings for the jumpers are printed on the hard drive so it is usually no trouble to set them.
As for assigning drive letters, you can do this in Windows XP by clicking Start-%26gt;Run and then type diskmgmt.msc in the run box and click ok or hit enter. This brings up the disk manager which allows you to specify drive letters as well as several other things like creating partitions and formatting.
Reply:When you install and set the second drive to slave, be sure you set the primary drive to master. This is not necessary on all makes, but WD requires it.
Reply:change the jumper setting
Reply:look on the back of the hard drive...u should see some small pins with a little black clip(jumper)..u can move the clip (jumper) from one to other..master or slave....once u do that and install hd..u will have to turn pc on..go to my computer..right click on the hard drtive and select ....format
if not..check this out
http://www.google.com.au/search?sourceid...
RE: Writing C# in Microsoft Studio? (with code)?
Ok, so I have code included this time. (it took me 5 min to write it in VB but no luck with C#, and for the person who said you can't write C# in Visual Studio...you can, but thanks)
This is the VB code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim radius As String
Dim area As String
Dim circumfrence As String
Dim diameter As String
Dim PI As String
PI = 3.1428
radius = TextBox1.Text
area = PI * radius * radius
circumfrence = 2 * PI * radius
diameter = radius * 2
Label3.Text = area
Label5.Text = diameter
Label7.Text = circumfrence
End Sub
End Class
I can set up the code in C# (this is for a windows application by the way) but it is being very stubborn in letting me take a users input and using it as a number. Thanks for any help! =)
RE: Writing C# in Microsoft Studio? (with code)?
Once you get the hang of it, C# is just as easy as VB
I've free-handing this, so I'm not sure it's going to be perfect..
I don't quite understand why you use strings for everything... numbers would be easier...
I use double.Parse() in here. this assumes you have entered good data. Look up TryParse to test your user's input...
Public Class Form1
Private Sub Button1_Click(ByVal sender System.Object, ByVal e As System.EventArgs) Handles Button1.Click
double radius;
double area;
double circumfrence;
double diameter;
double PI;
PI = double.Parse(3.1428); //can't remember if you need to parse this
radius = double.Parse(TextBox1.Text);
area = PI * radius * radius
circumfrence = double.parse(2) * PI * radius
diameter = radius * double.parse(2)
Label3.Text = area.ToString();
Label5.Text = diameter.ToString();
Label7.Text = circumfrence.ToString();
End Sub
End Class
That's the gist. Use the Parse method... I dont' have VS in front of me and can't remember if you have to .Parse those constants, but it will still work if you do it.
This is the VB code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim radius As String
Dim area As String
Dim circumfrence As String
Dim diameter As String
Dim PI As String
PI = 3.1428
radius = TextBox1.Text
area = PI * radius * radius
circumfrence = 2 * PI * radius
diameter = radius * 2
Label3.Text = area
Label5.Text = diameter
Label7.Text = circumfrence
End Sub
End Class
I can set up the code in C# (this is for a windows application by the way) but it is being very stubborn in letting me take a users input and using it as a number. Thanks for any help! =)
RE: Writing C# in Microsoft Studio? (with code)?
Once you get the hang of it, C# is just as easy as VB
I've free-handing this, so I'm not sure it's going to be perfect..
I don't quite understand why you use strings for everything... numbers would be easier...
I use double.Parse() in here. this assumes you have entered good data. Look up TryParse to test your user's input...
Public Class Form1
Private Sub Button1_Click(ByVal sender System.Object, ByVal e As System.EventArgs) Handles Button1.Click
double radius;
double area;
double circumfrence;
double diameter;
double PI;
PI = double.Parse(3.1428); //can't remember if you need to parse this
radius = double.Parse(TextBox1.Text);
area = PI * radius * radius
circumfrence = double.parse(2) * PI * radius
diameter = radius * double.parse(2)
Label3.Text = area.ToString();
Label5.Text = diameter.ToString();
Label7.Text = circumfrence.ToString();
End Sub
End Class
That's the gist. Use the Parse method... I dont' have VS in front of me and can't remember if you have to .Parse those constants, but it will still work if you do it.
How much cost can we save if we increase 1 degree of temperature in thermostat setting in A/C?
What is the size of the AC unit? What is the size of the area involved? What is your current temperature setting? What is the cost of a kilowatt for you now? All of this information is relevant to make exact precise calculations.
But the point of your question is that the less your AC unit has to work to lower the temperature between inside and outside the more energy you save and the more money you save. But how about 2 or 4 degrees. Try to raise it a degree a day and you will never notice the difference.
We could all use less energy.
But the point of your question is that the less your AC unit has to work to lower the temperature between inside and outside the more energy you save and the more money you save. But how about 2 or 4 degrees. Try to raise it a degree a day and you will never notice the difference.
We could all use less energy.
In mainframe advantage of C language over Cobol?
Hi,
In my project, entire programs have been written in Cobol; however, I found a set of programs written in C language. But, I have no information why these programs have written in C instead of Cobol.
Can any one please let me know why these small set of programs written in C, if you have already come across it at any time?
Thanks.
In mainframe advantage of C language over Cobol?
There are several possible explanations and even combinations of those. It could be that source code was purchased or already existed on a different platform in the same company that made an investment in the C compiler for the mainframe worthwhile to save effort. If the programs controlled some difficult to interface hardware in an abnormal way, that could explain why they are in C. If they were written to be used in a company at a time before they were starting to change to other platforms that lend themselves to C (Unix), they may have written the code in C to make the portability better later on. Or they may simply have hired programmers or analysts with special expertise for those projects who were more familiar with and fluent in C language. Take your choice. Or take a couple of choices and combine them. If you need to know, file comments with dates and such may give you the reason outright, or at least a clue or to about the decision to use C. I hope this helps you figure it all out. Pivy
forsythia
In my project, entire programs have been written in Cobol; however, I found a set of programs written in C language. But, I have no information why these programs have written in C instead of Cobol.
Can any one please let me know why these small set of programs written in C, if you have already come across it at any time?
Thanks.
In mainframe advantage of C language over Cobol?
There are several possible explanations and even combinations of those. It could be that source code was purchased or already existed on a different platform in the same company that made an investment in the C compiler for the mainframe worthwhile to save effort. If the programs controlled some difficult to interface hardware in an abnormal way, that could explain why they are in C. If they were written to be used in a company at a time before they were starting to change to other platforms that lend themselves to C (Unix), they may have written the code in C to make the portability better later on. Or they may simply have hired programmers or analysts with special expertise for those projects who were more familiar with and fluent in C language. Take your choice. Or take a couple of choices and combine them. If you need to know, file comments with dates and such may give you the reason outright, or at least a clue or to about the decision to use C. I hope this helps you figure it all out. Pivy
forsythia
Is plain text the same as blank, or do i use the default setting, i dont c any thing about plain text?
1. Yahoo Mail %26gt; Options %26gt; General preferances %26gt; Composing E-mails %26gt; Mode: %26gt; Compose messages as plain text %26gt; Save 2. Or = Select any email where the header information is displayed, but there is nothing in the
"body" of the message where you would expect to find text, etc.
Move your mouse to the area of the expected "body" of the message and right-click...on
the menu that appears, click on "Encoding"...on the menu that appears, if "Auto Select"
has a check mark, leave it as is...if not click "Auto Select"; then this menu will
disappear...right click again in the "body" to cause the same menu to display again...then
click on "Western European (Windows)"...you should now be able to view the "body" of
all messages that you couldn't view before...obviously, if the problem somehow occurs
again, do the same procedure described above again. I have no idea how or why these
settings get "changed" or "corrupted" after everyday use, but apparently they sometimes
do.
"body" of the message where you would expect to find text, etc.
Move your mouse to the area of the expected "body" of the message and right-click...on
the menu that appears, click on "Encoding"...on the menu that appears, if "Auto Select"
has a check mark, leave it as is...if not click "Auto Select"; then this menu will
disappear...right click again in the "body" to cause the same menu to display again...then
click on "Western European (Windows)"...you should now be able to view the "body" of
all messages that you couldn't view before...obviously, if the problem somehow occurs
again, do the same procedure described above again. I have no idea how or why these
settings get "changed" or "corrupted" after everyday use, but apparently they sometimes
do.
Subscribe to:
Posts (Atom)