Archive for the ‘using statement’ Category

Why do humans have the need to explain all things by using a religious blanket statement?

October 27, 2009 - 9:41 am 5 Comments

why are we here?
how was the universe formed?
what is my purpose?

When the need to know the answers exceeds logic and rational thought, can this be classified as crazy?

no.. i think ppl jus use it as something to cling on to. a belief tht gives them security? and mayb hope for something more? watever it may b.. but i don think it can be defined as crazy. religion has alwiz been a guide. i think thts about it.

Which statement is not how a scientist should act when using the scientific method?

October 25, 2009 - 10:12 am 3 Comments

Which statement is not how a scientist should act when using the scientific method?

experiment with only a few organisms or test subjects to keep the number of variables in the experiment manageable

randomize any variable that is impossible to control, like seed genetics

use statistically large samples in experiments to ensure that uncontrollable variables do not skew the results

test one variable at a time to ascertain its effect on the outcome of the test group

The first. The number of variables is independent of sample size and you want as large a sample as feasible.

How to solve for ohm’s law using the switch statement in C++?

October 17, 2009 - 8:21 am 2 Comments

Hey I have tried but I’m lost. I need a program that will determine the value based on what the user enters.
Such as:
User wants to solve for:
E - then ask for I and R
I - then ask for E and R
R - the ask for E and I.

I have to use the switch statement in C++. I have been trying to figure it out and I can’t. Can someone please help? Thanks :)
cout<<"Would you like to solve for E, I or R?";
cin>>userEntry;

switch (userEntry)
{
case ‘E’:
case ‘e’:
BLAHBLAHBLAH;
break;
case ‘R’:
case ‘r’:
BLAHBLAHBLAH;
break;
case ‘I’:
case ‘i’:
BLAHBLAHBLAH;
break;
default:
cout<<"Please select E, I or R"<<endl;
}

How to solve for ohm’s law using the switch statement in C++?

October 17, 2009 - 8:21 am 2 Comments

Hey I have tried but I’m lost. I need a program that will determine the value based on what the user enters.
Such as:
User wants to solve for:
E - then ask for I and R
I - then ask for E and R
R - the ask for E and I.

I have to use the switch statement in C++. I have been trying to figure it out and I can’t. Can someone please help? Thanks :)
cout<<"Would you like to solve for E, I or R?";
cin>>userEntry;

switch (userEntry)
{
case ‘E’:
case ‘e’:
BLAHBLAHBLAH;
break;
case ‘R’:
case ‘r’:
BLAHBLAHBLAH;
break;
case ‘I’:
case ‘i’:
BLAHBLAHBLAH;
break;
default:
cout<<"Please select E, I or R"<<endl;
}

What is the purpose behind using a throw statement to throw exceptions?

October 11, 2009 - 10:22 am 1 Comment


You can rethrow an exception, using the throw statement. You can nest try catch statements, for instance, and if you don’t want to handle an exception in an inner try catch pair of statements, you can throw it so that it’ll be handled by the outer try catch statements.

sort 3 numbers in java script using an if statement?

October 7, 2009 - 6:15 am 1 Comment

What im trying to do is ask a person for three numbers with a prompt and take those numbers and sort them using an if statement. and printing them onto the page. I cant seem to figure out the proper way to write the if statement. Anyone have any ideas or can explain how i can write it?

This should help

What is the purpose behind using a throw statement to throw exceptions?

October 5, 2009 - 4:00 pm 1 Comment


You can rethrow an exception, using the throw statement. You can nest try catch statements, for instance, and if you don’t want to handle an exception in an inner try catch pair of statements, you can throw it so that it’ll be handled by the outer try catch statements.

"Free Trade is not always Fair Trade"- Defend this statement using 4 Arguments (and examples)?

October 5, 2009 - 3:59 pm 4 Comments

I am writing an in-class essay tomorrow, and we are allowed to prepare our essays today. So the topic that I am writing on is: "Free Trade is not always Fair Trade"- Defend this statement using 4 Arguments (and examples) to support your viewpoint. I am having some difficulties coming up with 4 arguments/examples. Any help would be greatly appreciated.

-thanks

Because what is ‘fair’ depends more on your point of view than anything else.

For example: ‘Free Trade’ tends to result in food that is less expensive than the locally produced stuff being imported. As a result the local farmers lose their livelihoods because they cannot compete. OTOH the rest of the people benefit because they now pay less for food.

Is it ‘fair’ do drive the farmers out of business? Is it fair to force the consumers to pay more for their food in order to subsidize the farmers?

It all depends on your point of view.

Using C++ how can I write a statement using the setfill manipulator to output a line of 35 stars?

October 3, 2009 - 6:10 am 3 Comments


#include <iostream>
#include <iomanip>

using namespace std;

void main()
{

cout<<setfill(’*')<<setw(36);
cout<<" "<<endl;
}

can we print a statement on out put screen without using any print statements in c-programing language?

October 3, 2009 - 6:10 am 3 Comments

if i want want to print "hello" or any other string generally we use printf statement in c-language.But i want to know ,can we print a string on out put console witout using printf statement

Printf() is what is typically used from the Standard C Library. However, if you need to make a non-standard call, there are usually operating system specific functions to accomplish native I/O. Printf() is portable but other calls won’t be cross-platform.

If you’re writing in terms of Unix, take a look at the Curses Library (see links below). Using curses, programmers are able to write text-based applications without writing directly for any specific terminal type. The curses library on the executing system sends the correct control characters based on the terminal type. It provides an abstraction of one or more windows that maps onto the terminal screen. Each window is represented by a character matrix. The programmer sets up each window to look as they want the display to look, and then tells the curses package to update the screen. The library determines a minimal set of changes needed to update the display and then executes these using the terminal’s specific capabilities and control sequences.

For the DOS console, you’d most likely make BIOS calls (interrupt 10h) which printf() eventually ends up executing. If you have a Windows-based system, there is always DirectX or OpenGL…

For completeness, I should mention that on some machines, there is memory-mapped I/O for the video hardware. Therefore, you could determine the method to address the video hardware directly assuming the OS allows it (without writing your own device driver). You’d need to be much more specific with your question to determine if this is what you’re seeking.

Note: tadds, you’re supplying C++ code (Stream I/O) instead of the requested C-only advise.