Bench 212 Posting Pro

If by 'bridging' you're referring to Internet Connection Sharing (ICS), then click that link for some guides on how to use the ICS which comes with Windows. (What ICS actually does is turn the computer into a router.. although its most popular application is for sharing an internet connection)

Could you elaborate on what you mean by "can't have both network cards enable at the same time"? Do you mean that the hardware physically conflicts (As in, some kind of problem relating to the drivers/motherboard/hardware/BIOS/firmware/etc) ... or had you set them up to use conflicting network addresses?

If the network cards are working fine, and you've set them up with 2 different IP addresses on the same 'logical' network, then the answer to getting them working is a case of changing the network portion of the IP address.
(My interpretation of some of the problems you experienced last year would be that you had multiple networks using the same network address - this is something that is guaranteed to cause all devices and computers on the networks to get confused)

Out of curiousity, what Settings have you set for each adapter? namely, IP address & Subnet mask?

Bench 212 Posting Pro

Is your onboard ethernet controller sharing its IRQ number with any other onboard devices? (Such as one of the SATA controllers perhaps?) If so, see if you can disable any unnecessary onboard devices in the BIOS to free up some IRQ numbers. This should cause the BIOS to reassign one or more devices.

Bench 212 Posting Pro

hey thanx...but i want to know the exact syntax i need to write to make a rectangle move when a user presses the right or left key. I'm new to Turbo c++ and i would really need all the help i can get.

Thanx a lot

Start with something a bit more trivial - Learn how to manipulate user input, and how to generate output first. then you'll be one step towards creating a program which combines input/output.

There is no "exact" syntax for doing what you want.. How you accomplish it is entirely up to you, although you need to learn the basics first, then you'll know what options you have available to you.

Bench 212 Posting Pro

So it depends what you mean by powerful. Just because c happens to be slightly easier to understand than assembly has nothing, in my opinion, to do with power.

I have to strongly disagree there. For the same reason that software applications are always judged based on their abilities to make hard stuff easier. For example, Adobe Photoshop is classed as a powerful application, because of the many, many ways its able to manipulate images. But at their core, images are just a bunch of pixels with different colour values. By your example, the free 'paintbrush' utility which comes with Windows is just as powerful as Adobe Photoshop.

In the same vein a language is generally classed as more-or-less powerful based on the different paradigms, abstractions, library features, etc that it has available to support developers along their way in creating software suitable to the task in less time (Taking many different factors into account, like those listed by S-O-S), rather than whether its capable of producing the perfect-world, fastest-running, and most highly-optimised application regardless of the number of extra man-hours it takes to do.

Bench 212 Posting Pro

I guess he used the [COLOUR=WHITE] tag.. I'm not sure why Daniweb even has this, since AFAIK, its not possible to change the background of posts (Probably a good thing...)

I imagine a few other colours on that chart would be pretty nasty to read aswell... Maybe that rule should be "No unreadable colours" :)

Bench 212 Posting Pro

Yup, i forgot to clear the state earlier..

The only other alternative to cin.ignore etc.. would be

std::cin.clear();
std::cin.sync();
std::cin.get();
Bench 212 Posting Pro

In which case, you may aswell stop trying to get the non-existant speaker to make a noise ;)

Bench 212 Posting Pro

For a standard, safe way of getting the program to pause, you could use a function like this

#include <iostream>
#include <limits>

void stop()
{ 
    std::cin.ignore( std::numeric_limits<std::streamsize>::max() , '\n');
    std::cin.get();
}

int main()
{
    stop();
}
Bench 212 Posting Pro

Are you sure you've actually got an internal speaker? Not all motherboards have a connector for it. (Does your computer make a beep when you turn it on..?)

John A commented: You think of everything... -joeprogrammer +4
Bench 212 Posting Pro

But the pseudo code for the sieve of Atkin is written for you. All you have to do is copy it on paper and hand it in.

I wouldn't do that. Most institutions have rules against plagiarism & cheating. Copying & pasting directly from a website is almost certainly going to breach those rules.

It sounds to me as if the original poster has already solved the problem and just needs to rewrite it into a design document with pseudocode - so chances are, that wouldn't be much help anyway (unless his code is directly based on the sieve of atkin).

changing source code to pseudocode is easy! You don't need to say anything about libraries or data types, and you can also ignore certain rules on scope too - just translate each line or block of code into simplified english.

for example, a C++ program that prints all even numbers from 0 to 10 might look like

#include <iostream>

int main()
{
    for(int i(0); i!=10; ++i)
        if( i % 2 == 0)
           std::cout << i << " is even." << std::endl;
}

The pseudocode could look like this..

for N = 0 to 10 do
    if ( N / 2 has no remainder )
        write ( N " is even" )
    end if
end for

In the pseudocode, there's no need to explain minor details such as how you express N/2 having no remainder, or how you are going to 'write' something to the …

Bench 212 Posting Pro

Hi,
Thank for you help.
You meant I have to create linked lists and use searching ..that certain character is already in output.. if true .. set it to concerning value?
Or use vector?
Coz I am not sure how to do it..

You could also use the string which is already a part of your program - the position of each character in that string can act as an index reference for a table of card values - eg,

const std::string ranks("ajqk");
    const int values[] = {1,10,10,10};

all you need to do from there is find the position of the letter in the string and use that to find the value of the card.
(You would need to add a check to make sure the letter is actually inside the string first)

Bench 212 Posting Pro

There's a whole load of ways you can do this - depending on the way the rest of your program works, one way you could achieve this would be to set some constants, eg,

const int ace = 1;
const int jack = 10;
const int queen = 10;
const int king = 10;

Another way may be a lookup table where you associate characters with values, and search through that to find the match.

Bench 212 Posting Pro

Correct, this sort of thing is known as short circuit evaluation.

it also happens under logical OR evaluation when the left-hand-side of the expression yields 'true', ie

if ( true || false )

The program knows that there is no need to evaluate the right-hand-side, since the result of the boolean expression is already known for certain.

As you see in the example you've found, this is sometimes used in subtle ways to perform checks before executing a statement - Which is not always a good idea IMHO, because it runs the chance of being accidentally changed to introduce weird bugs! For example

int n=0;
if ( n!=0 && 10/n == 2 )

if this check was improperly altered in this block of code, the program could crash

int n=0;
if ( 10/n == 2 && n!=0 )
    //Bad: Looming catastrophe!
Bench 212 Posting Pro

Hey, am very grateful to you all for the contributions. Lerner,thanks a bunch, cos u really made me try to get the logic behind d fabonacii series.Even after giving up.Now i know how to get the other nos in d series but my problem is outlinin it in the if-else format.

Outlining it in if/else format isn't strictly necessary - Remember that Pseudocode is supposed to mimic a simplified version of the english language(or whatever other language the programmer would speak naturally) at an appropriate level of detail, so that the pseudocode can be easily translated into a program.

for example, pseudocode for going to the supermarket might be something like

Walk to car
if ( car locked )
    unlock car
end if
get in car
fasten seatbelt
start engine
drive to supermarket
if ( supermarket closed )
    go home
else
    go shopping
end if

One approach to solving your problem could be to work out how you calculate the fibonnaci sequence on paper, and make a note of every small step you make along the way, including the data you're holding, your processes/calculations, and the results. When you've done it for several numbers in the series, you'll notice patterns emerging.

Bench 212 Posting Pro

how fast can you talk? why can't you talk any faster?

icantalkreallyfastjustthatnoonecanunderstandme.. :rolleyes:

Bench 212 Posting Pro

Did you remove all the traces of the old drivers before installing the new card? and does windows device manager show any conflicts?

What's connected to your IEEE1394 (Firewire) port? do you even use it? if not, you may want to disable it in the BIOS, in case its conflicting.

Bench 212 Posting Pro

In answer to the majority of the questions you've posted - Standard C++ has no way of directly interfacing with hardware - such tasks are beyond the scope of the standard. You'll need to visit documentation for your compiler/implementation.

Yes you can create programs for virtually any platform - which is the reason why C++ has no built-in support for any kind of hardware.

Instead of just flooding this forum with a long list of questions, why don't you actually make some kind of an effort to find out?

Bench 212 Posting Pro

(Status Quo) Accident Prone

Bench 212 Posting Pro

Well, that was predictable.... :rolleyes:

http://www.todayspatio.com/images/odls_park_bench3.jpg

Bench 212 Posting Pro

Found in about 15 seconds in Sun's java documentation...
http://java.sun.com/docs/books/tutorial/java/javaOO/enum.html

Bench 212 Posting Pro

That's because with Accelerated C++ you get all the meat and none of the empty calories.

Indeed, that's one way to put it! AC++ is far more concise than most other C++ books out there, taking 337 pages to explain what many books take 1000 pages by waffling on. Also uses a rather different approach to teaching than other books I've seen too (IMHO, and in the authors' opinions, their approach of teaching the STL before touching on arrays & pointers is the right one)

Bench 212 Posting Pro

I've never read Dietel & Dietel, but judging from the ACCU review, that book would be a poor choice, and you'd end up learning out-of-date C++ (That's a very bad thing!)
http://accu.org/index.php/book_reviews?url=view.xqy?review=cp003204&term=beginner\'s+c%2b%2b

I'd suggest you have a look at the ACCU site before shelling out any money whatsoever - the best thing you can do is find a book which isn't going to mislead you!
http://accu.org/index.php/book_reviews?url=search.xqy?field=subject&term=beginner's+c%2b%2b

Bench 212 Posting Pro

The problem is probably Borland 3.1 - I see no reason why this code shouldn't compile in either C or C++ (it worked fine using Comeau online in strict mode).

I would reccomend talking to your teacher and asking why you are being taught an outdated version of the language (Borland 3.1 doesn't support many of the features which are a part of today's standard C++)

Aside from this, what exactly requires you to use so many global variables? there is more than likely another way to redesign your program without using global variables at all.

SpS commented: Right Advice ~~ SpS +3
Bench 212 Posting Pro

VB c++ is visual basic c++ don't ya know?

So which one are you programming in? Visual Basic or C++? or are you attempting to learn 2 languages at the same time?

Bench 212 Posting Pro

>>How long is a piece of string?
depends on where you cut it with your scissors. (sorry for the bad joke, I just couldn't resistet temptation :eek: )

Its twice as long as half its length, of course ;)

Bench 212 Posting Pro

(Scissor sisters) I don't feel like dancing

Bench 212 Posting Pro

The compiler must be told every single time a section of code is templated,
essentially, you need the template parameter list for both the forward declaration at the top of your program (which you already have) and then again when you actually define it. ie

template <typename T>
T calculateAverage(T dataValue[], int size)
{
    T total=0;
    for(int i=0; i<size; i++)
        total = total + dataValue[i];
    return(total / size);
}

Simply having the template parameter list at the forward declaration isn't enough - since when you reach the definition of calculateAverage, the compiler doesn't know what T is (template parameter lists are not strictly part of a function signature)

Bench 212 Posting Pro

Your code is difficult to read - try adding some formatting!

a few points to note

1) Why is there a semicolon before int main() ? Presumably its supposed to belong to the function prototype 2 lines up - you should put it there instead, else it just looks like an error to anyone who's casually reading your code. (This won't stop the program from working, its just bad style IMO)

2) Get rid of the semicolon at the end of the line where you define calculateAverage after the end of main

3) calculateAverage is presumably supposed to be a templated function, so you need to specify template <typename T> before you define the function, else the compiler has no idea what T is.

4) inside calculateAverage there is a for loop - you haven't declared 'i' before attempting to initialise it

If you fix those errors, the program should compile (Although I haven't checked the logic of the program)

Bench 212 Posting Pro

Oh? show me someone who hasn't died of something:cheesy:

to quote the late, great Bill Hicks - "All you health freaks out there are going to feel pretty stupid on your death beds dying of nothing" ;)

Bench 212 Posting Pro

2.Main and other functions default to int return type. ISO standard requires main to be return type int always.I accept. But my compiler and my friends compiler didnot complain when main was not specified with returntype int.

Just because something works on your compiler or your friend's compiler doesn't mean that it will work on other people's. Compilers are allowed to work in ways which aren't defined by the standard, such as allowing void main() - implementations which conform more strictly to the standard are well within their right to complain about this (And some do!).

If you intend your site to be used as a reference for beginners, then may I suggest that you make no assumptions about what compiler your visitors might be using. or whether or not they are compiling in a mode which adheres strictly to the standard.

Bench 212 Posting Pro

Aside from being difficult to read against that background, an awful lot of that makes no sense, is innacurate or completely wrong.

return type of main and any function is defaulted to int.(0 if success and 1 if failure)

return types are never defaulted to anything. the standard specifies that main must return an int, however, it is not valid to simply write your function signature without explicitly specifying a return type.

Array elements that donot have initializers are assigned '0'.

That's not true for either C or C++. Array elements which are uninitialised remain uninitialised. To access an uninitialised variable or array element is undefined behaviour.

Bench 212 Posting Pro

In trying to map a network drive from "My Computer" and then "Map Drive", it's not finding my shared folder on my old laptop. Basically I'm trying to map a drive on my new laptop to the "C" drive on my old laptop to share data between them.
I know that my old laptop is named "JohnsLaptop" and the shared "C" drive is named C$. The "C" drive has the little hand under it, so I know it's being shared. However, it doesn't show up when I browse for it or when I type it in explicitly. I'm typing
\\JohnsLaptop\C$

Any ideas?

From what I recall, you can't use the C$ "default share" in order to share a drive - you'll need to create a new share and use that instead. My best guess is that C$ is something to do with resource sharing for local users rather than remote ones.

Roobyroo commented: Helpful +1
Bench 212 Posting Pro

Is it possible to share a printer over a wireless connection? If how, could you please help me. Thanks.

Assuming your OS is some flavour of Windows, then the same service which you use for sharing drives and folders can be used to share printers. On the machine which owns the printer, look in your Printers window, select the properties of the printer, Find the tab labelled "Sharing" - the rest should be self-explanatory.

The type of medium over which you're sharing the resource (Wi-Fi / Ethernet / Bluetooth / etc) is irrelevent, provided the configuration for that connection is setup properly - For Windows NT/2K/XP/etc you need to enable NetBIOS on both computers in order for file & print sharing to work correctly.

NetBIOS usually runs over TCP/IP - there's a setting in the TCP/IP properties in your network configuration which will allow you to enable NetBIOS.

failing this, NetBIOS can also run over Novell Netware's IPX (Used more commonly for older versions of Windows)

Bench 212 Posting Pro

You get a Tesco.

I put in a loyalty card

Bench 212 Posting Pro

Intro

The focus of this tutorial is the code relating to decision making and selection, and not the I/O code. I do not advocate using scanf() in this way for anything other than testing blocks of code in 'toy' programs. If you feel the need to use scanf() when writing more serious programs, please read this: http://c-faq.com/stdio/scanfprobs.html

Switch statement selection

A common question from C beginners comes along the lines of "How can I use a switch statement with a string or a character array?" (It was a question similar to this which prompted the creation of this tutorial) to which the short and simple answer is: You can't. Because a switch statement requires an integral value, such as int, long or char. A similar cry is often heard from beginners to C++ and Java. The usual solution is to write an if/else block instead - but this loses some of the simplicity and brevity which can make switch statements more attractive.

A more in-depth answer to this question may be that there is a workaround available, which allows the use of a switch statement, with the ability to make a decision based on a string.

The 'vending machine' program

Given a common beginner problem to introduce switch statements, the 'vending machine', where a user types in their choice of drink/snack/etc, the program is generally restricted to a numbered menu

Typical Output

"Press 1 for chocolate"
    "Press 2 for biscuits" …
Bench 212 Posting Pro

( Haddaway ) What is love?

Bench 212 Posting Pro

Dragon-

I will include my full code below, I had edited out a few things for brevity.

Why do you not construct the Opra_record here:

Opra_record* rec; // = new Opra_record;

Is there a implicit construction somewhere?

Is there any reason why 'rec' is a pointer? It seems to me that you simply want to create an instance of Opra_record .. you don't want a pointer to an object, nor do you want to allocate any memory dynamically with new.

simply typing Opra_record rec; will invoke the default constructor for Opra_record

Also - Your overloaded >> operator deals directly with Opra_record objects and not pointers.

Edit - I've just noticed you attempt to read your file while !in.eof() - this is almost always wrong - you should read while the fstream is in a good state, and not until you hit an error.

a better statement would be while ( in >> rec )

Bench 212 Posting Pro

You get a Firefly

I put in a Serenity DVD

Bench 212 Posting Pro

never used one so I have no idea. So a strap breaks, so what? what happens? do you get electricuted or something?

>>breaking and it slipping out of their hands, causing damage to TV's, windows, lights and people, amongst others

Ok, lets say you are holding one of those little monsters and the strap breaks. How in the world could it possible damage a TV, window etc. etc. ? When it hits the floor does it explode like a stick of dynamite?

Have you seen any of the Wii adverts? The idea of the "Wii-mote" (is that how its spelt?) is that you wave it around in the air, as if it were a sword, or a knife, or a fist, or....

I guess a few people must have just gotten a little over excited whilst playing with their new Wii :)

Bench 212 Posting Pro

I've heard a similar one to that before -

Success in mathematics is 90% perspiration and 20% inspiration

One of my usenet and e-mail signatures for a very long time -

"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989

I get a kick out of reading people's signatures and find many of them funny and witty. Which ones do you like?

Alot of signatures are also pretty awful, or cliched, or taken from well known quotes, (and are seen all over the place!). The best ones are usually the few which are are original or little known :)

Bench 212 Posting Pro

Hello Friends,
I am in my final semester of IT course. Need to make a project & i have though of Flight Rerservation system and worked out some outlines as well. But now i am badly stuck with some problems.. well the list is quite long:sad: .

But most importantly right now is that as i worked out some tables and future classes, i couldn't figure out how time table can be set for different flight. See its a web based sytem which gives user to book flight for that day till next 1 year. How should i store data regarding flights for a year. lets say in 1 week, flight A flys on mon & wed, flight B on all days and so on. Couldn't really design a table for that.

It sounds to me like you're jumping in at the wrong end.. If this is a final year project, then you're probably expected to create Problems/Requirements documentation, Context diagrams, DFDs, Entity-relationship models, Data dictionaries, maybe some kind of brainstorm or mind map... etc.

There's a good reason why all this analysis stuff comes first - because it gives you a place to start, and you should end up with a pretty good idea of whats going on in the system, what kind of data you're going to be holding, what sort of entities exist, and what sort of processes you need.

Once you get there, I expect you'll know with far more certainty what tables …

Bench 212 Posting Pro

Hi,

I'm new to this forum and I'm really interested in futhering my education into computer technologies.

I'm starting school again...and I don't like talking to my school counselor because I always get the feeling that they don't want to really spend their time giving me a hand or don't really know the answers.

What I'm interested in finding out is what trends are popping up in computer work and what type of programming / demands are on the rise. I know that IT professionals are going to be in high demand, so I'm considering this field.

My problem is I don't know where to start. What programs are essential to learn and what should I look into?

Thanks alot and again, any help is much appreciated,

Marty:mrgreen:

If you take a look at any recruitment websites or papers, you'll get a list of 'buzz' words as long as your arm: ASP, SQL, Java, XML, Cisco, MCSE... to name but a few! Along with typical applications (MS Office suite, project management software, etc), as well as something along the lines of "Educated to degree level or equivalent", or otherwise pointing to potential candidates with a strong mathematical/science background .

Having a list of 3-letter acronyms in your CV, and a BSc after your name generally looks good on paper, but in an interview situation for any job, most employers will be trying to ascertain not just your knowledge on a your chosen area of IT, but just as importantly, …

Bench 212 Posting Pro

Could someone help me?

I have an file in which a list of employees and salaries are listed for each year

ex:

Year: 2005
No. of Employees: 3
Employee ID Salary
123456 36000.00
123567 32000.00
123678 33000.00
Year: 2006
No. of Employees: 4
Employee ID Salary
133456 31000.00
133567 32000.00
133678 33000.00

How do I open all these data into arrays?

This is my code, and I don't think it is good since it only reads the lines and not the data

After you've read a line from the file as a string, you can parse the string to extract the data you need.

It would be helpful to define the rules as to the layout of your file (eg, first line is always a header containing the year, second line is always a header containing the number of employees, etc). At first glance its not immediately clear whether your file has any consistancy. If possible, you may want to change the format of your file somewhat (eg, by adding delimiting characters which show the start and end of the data, and even its type). Once you've clearly defined the format of your file, you can create functions which will parse the input to extract each item of useful data, and ignore superfluous information.

When you've defined your file format 'rules' - try creating a function which parses just the first line, and test it. …

Bench 212 Posting Pro

What do you mean by "on screen"? do you mean..

  • Output spanning the entire screen?
  • In a window?
  • Across the command-prompt background?
  • On the screen of a PDA/Phone or other mobile device?
  • Something else?

Standard C/C++ has no concept of BMP files, nor any kind of video display output (Nor anything else that can be deemed implementation-specific)
- Depending on your O/S and compiler, you may already have libraries which are capable of handling these kinds of tasks, otherwise you'll need to download some 3rd party APIs

Bench 212 Posting Pro

For a crossover cable:

End 1 : T568A

Pin 1 - Orange/White
Pin 2 - Orange
Pin 3 - Green/White
Pin 4 - Blue
Pin 5 - Blue/White
Pin 6 - Green
Pin 7 - Brown/White
Pin 8 - Brown


End 2 : T568B

Pin 1 - Green/White
Pin 2 - Green
Pin 3 - Orange/White
Pin 4 - Blue
Pin 5 - Blue/White
Pin 6 - Orange
Pin 7 - Brown/White
Pin 8 - Brown

Pins 1 and 2 are Tx (Transmit), while Pins 3 and 6 are Rx (Recieve) - So make sure Pin1 connects to Pin3, and Pin2 connects to Pin6. Don't just use any old colour either - the reason for the colours being in the order they are, is that the colours match the twisted pairs inside the UTP cable. (the twists are there deliberately to cancel out crosstalk)

Be careful when crimping the ends - Make sure there's only just enough of the jacket stripped for the wires to firmly make contact with the RJ45 pins - too little and there'll be no connection... too much, and your cable will suffer from excessive Crosstalk (NEXT).

If initially you strip off too much of the jacket, you can trim the wires with a pair of scissors, use the the RJ45 plug as a guide to the length you'll need

See here …

Bench 212 Posting Pro

Such a program is known as a 'Quine' - see here for more info http://en.wikipedia.org/wiki/Quine_%28computing%29

Salem commented: Beat me to it - Salem +4
Bench 212 Posting Pro

I need a little help calculating odds for a roulette game.. i'm not sure why someone would bet 1:1 odds.. to me, that just means you win your money back without making a profit

No, that's not what it means. 1:1 refers only to your winnings. Whatever amount you initially forked out is always retained (Provided that you didn't lose). The only time you don't get your money/chips/etc back is when the bank wins (which, as you probably realise, happens more often)

Bench 212 Posting Pro

You can't do it and it's a good thing. Altering a user's browser is very bad form.

I was fairly sure it wasn't possible when i wrote that message, Else I'm sure by now I'd have been directed to one of a-lebenty-something "joke" websites which remove your browser history and fiddle with your settings (in such a similar vein to those which used to use recursive popup windows in order to crash your browser - oh, the hilarity!)

Bench 212 Posting Pro

Also, I would consider any code which attempted to automatically delete anything from my machine (whether it were browser history or otherwise) without my permission as malicious code.

Your intentions may not be malicious, but you should seriously think about how users of your website are going to react. You'll find your site losing its visitors pretty quickly!

Bench 212 Posting Pro

So, where's your attempt..?

Look here : http://www.daniweb.com/techtalkforums/announcement9-2.html