February 2012
M T W T F S S
« Mar    
 12345
6789101112
13141516171819
20212223242526
272829  

Buffer Logic

Buffer Logic
Buffer Logic
C++ program help - using - answer within 6 hours please!?

This is the program:

#include
#include

using namespace std;

const char *get_greet();

int main(int argc, char **argv)
{
if(argc<2)
{
cout <<"please enter name" << endl;
}
cout << get_greet() << " " << argv[1] << "!" << endl;

return 0;
}

The questions are:

1. Write pseudo code illustrating the logic you will have in the function get_greet

2. If definition of get_greet was "void get_greet(char *buffer, int size)", what are the changes you have to do to main() to get it working?

Any help is appreciated.
Thank you so much
This is NOT homework. And it is not any sort of schoolwork/tutorial.

I have already tried it out, but I get an error. I checked documentation, but that was no help.

Looks to me like get_greet returns a greeting specific to the time of day, so if hours < 12 it would be "Good Morning" or if hours>18 "Good Evening." Why don't you open up your time.h header file or look up the documentation elsewhere (I use GCC. They kind of EXPECT you will open and read your header files if you want to use them properly).

The answer to number two seems obvious but if this is homework believe me, we are doing you no favor by answering that question.

EDIT: Okay, the point would be you would want to extract hours from an asctime() string. I've added a discussion of it in sources. The asctime() string is a fixed-length string, so you simply go to the place where hours start, extract that and the next char, convert them to an integer (probably using itoa() which means storing them in a 3-char string and making the third char '') and going from there.

The answer to your second question of course is in theory you can just do a cout << get_greet(buffer, SOME_SIZE) << " " << argv[1] << "!" << endl; assuming SOME_SIZE is #defined up above as the maximum number of chars to put in buffer and buffer is defined as a block of memory which is large enough to hold enough chars. {Incidently, I tend to send printf and cout ' ' and '!' rather than " " and "!" because when you use single quotes it sends chars but when you use double quotes it sends a two char array with the second char being''. I know it doesn't save a lot but I've been questioned about why my code compiles smaller than some other peoples}.

You CAN do the above. It will evaluate get_greet(buffer, SOME_SIZE). It may be easier for you if you execute that above the cout statement and then just send it buffer.

Again, you either have to declare buffer as an array of fixed size, or allocate enough memory using malloc and remember to free it before exiting. And of course you can send get_greet a variable or a const or a digit, but the advantages of #defining a SOME_SIZE are if you have to use it elsewhere in the program you change it once -- while the program gets no chance to change it as the preprocessor will substitute whatever number is there for every occurance of SOME_SIZE, and with the right name people will know exactly what it is for.

Is that helpful?



No items matching your keywords were found.

Glyph Technology 1TB Quad Desktop Hard Drive Glyph Technology 1TB Quad Desktop Hard Drive

List Price: $449.00

 

Description

Glyph's GT 050Q builds upon the success of the original GT 050 and adds FireWire 800, eSATA and USB ports. With high-speed access to audio and video content, and flexible connectivity options, the GT 050Q's design features an internal Power Supply, whisper-quiet fan, and a 1/8" thick-brushed stainless steel faceplate...

Features

  • Desktop HDD - 5,900 and 7,200 RPM
  • eSATA, FireWire 800, FireWire 400, USB 2.0
  • High quality storage mechanism
  • Oxford 924 bridging chip for optimized use with Pro Tools
  • eSATA Connectivity - 7,200rpm
Seagate FreeAgent Go 500 GB USB 2.0 Portable External Hard Drive ST905003FGA2E1-RK (Silver) Seagate FreeAgent Go 500 GB USB 2.0 Portable External Hard Drive ST905003FGA2E1-RK (Silver)

 

Description

Easily take your photos, music, videos and documents everywhere with the sleek Seagate FreeAgent Go portable storage solution.The FreeAgent Go drive offers up to 500GB of capacity, so you can comfortably store all your files...

Features

  • 5,400 RPM Spin Speed, 8 MB Cache Buffer
  • USB 2.0: up to 480 Mb/s
  • Sync and back up quickly at your desktop without having to search for cables.
  • Guard the privacy of important files and folders.
  • Get your storage solution up and running quickly.
8-PORT Int., 6GB/S Sata+sas, Pcie 2.0, 1GB Ddriii; In The Box: Mr Sas 9265-8I, Q 8-PORT Int., 6GB/S Sata+sas, Pcie 2.0, 1GB Ddriii; In The Box: Mr Sas 9265-8I, Q

List Price: $780.00

 

Description

LSI Logic MegaRAID 9265-8i SAS RAID Controller - Serial Attached SCSI, Serial ATA/600 - PCI Express 2.0 x8 - Plug-in Card LSI00277 Hard Drive & RAID Controllers

Features

  • MEGARAID SAS 9265-8I SGL.
  • Storage Controller / Channel Qty 8.
  • Controller Interface Type Serial ATA; Serial Attached SCSI.
  • Data Transfer Rate 6 Gbps; Cache Buffer Size 1 GB.
  • Interfaces & Connections Two mini-SAS SFF-8087 x4 connectors, x8 PCI Express 2.0 host interface.
Targus Citygear York Black Grey Yellow Nylon Notebook Case Targus Citygear York Black Grey Yellow Nylon Notebook Case

List Price: $123.90

 

Description

Also included are a removable mesh accessory pouch, removable CD/DVD sleeves that hold 8 discs and a detachable mobile phone case. There is a rear document storage section and a luggage strap for easy attachment to rolling cases.

Features

  • Manufacturer/Supplier: Targus Group International. Product Type: Carrying Case. Accessibility: Top Loading.
  • Maximum Screen Size Supported: 15.4 inches. Compartment Height: 14.20 inches. Compartment Width: 2 inches. Compartment Depth: 11.60 inches. Color: Black, Gray, Yellow.
  • Exterior Material: Nylon. Package Contents: Notebook Case, Removable mobile phone pouch, Removable mesh accessory pouch, Removable CD/DVD sleeves.
  • Application/Usage: Notebook. The CityGear New York Notebook Case supplies an abundance of features in a fashionable new design.
  • It includes a padded section for your notebook protection, a zip-down workstation with storage for business cards, media, pens, pencils and more.
New Targus Black Blue Neoprene Notebook Slip Case Top Loading Shoulder Strap Handle Compact New Targus Black Blue Neoprene Notebook Slip Case Top Loading Shoulder Strap Handle Compact

List Price: $73.92

 

Description

It has ample space in the front and interior storage sections for business cards, pens, keys and files. Also featured is the unique shock-absorbing EqualizerStrap that evenly distributes weight over your shoulder for greater comfort.

Features

  • Manufacturer/Supplier: Targus Group International. Product Type: Carrying Case. Accessibility: Top Loading.
  • Maximum Screen Size Supported: 17 inches. Compartment Height: 16.50 inches. Compartment Width: 2.25 inches. Compartment Depth: 13 inches.
  • Color: Black, Blue. Exterior Material: Neoprene. Application/Usage: Notebook.
  • The Targus 17 inches Notebook Slip Case features a neoprene exterior, which provides protection for your notebook and soft comfortable carrying handles.
  • This slip case accommodates notebooks with screens up to 17 inches and even though it has a slim design.
Targus Citygear Miami Black Yellow Nylon Messenger Case For 17 Inch Notebook Targus Citygear Miami Black Yellow Nylon Messenger Case For 17 Inch Notebook

List Price: $106.90

 

Description

There is a padded notebook compartment, a section for file storage, removable mobile phone pocket and even a hidden water bottle pocket. Sleek and professional, this case supports notebooks with up to 17 inches screens.

Features

  • Manufacturer/Supplier: Targus Group International. Product Type: Carrying Case. Style: Messenger. Accessibility: Top Loading.
  • Maximum Screen Size Supported: 17 inches. Compartment Height: 16.50 inches. Compartment Width: 2.25 inches. Compartment Depth: 13 inches. Color: Black, Yellow.
  • Exterior Material: Nylon. Application/Usage: Notebook.
  • The CityGear Miami Messenger Notebook Case has lots of features in a sporty, stylish lightweight design.
  • Features of this case include a zip-down workstation with holders for business cards, media and more, plus mesh accessory storage pouches.
HEX LOGIC DA/ PORTER CABLE BUFFING PAD SAMPLER PLATTER -HEX-LOGIC PADS + DA BACKING PLATE HEX LOGIC DA/ PORTER CABLE BUFFING PAD SAMPLER PLATTER -HEX-LOGIC PADS + DA BACKING PLATE

 

Description

Hex-logic pads are engineered and developed for today's pickiest detailing professionals. Engineered, developed and tested to specific requirements of our OEM clients these pads utilize the best foams from around the world and the latest of testing and research and development including Chemical Guys own Self Centered backing system! The Hex-Logic Chemical Guys Pads are meant to work on flat or rounded/angled surfaces...

Features

  • Professional-Grade pads, Premium quality foam pads, Longer lasting, more durable pads #
  • 25% more surface area than regular 6" pads, Faster easier and more accurate results
  • Unique Self-Centered systems delivers a perfectly centered pad every time, Unique Patented system delivers a safer pad with less vibration
  • Easier to use then any pad available today, Self Centering Ring is flexible bendable and easy to wash rinse off and re-use
  • Self centered pads also come in hew HEX-Logic
HEX LOGIC 6.5 HEX LOGIC 6.5" BEST OF THE BEST BUFFING PAD EVERYTHING KIT + FREE BONUS (8 ITEMS)

 

Description

HEX-LOGIC -Yellow Heavy Cutting Pad 6.5" (yellowed)
HEX-LOGIC -Swirl & Scratch Remover Pad, 7.5" (orange)
HEX-LOGIC -Green Heavy Polishing Pad, 6.5"(green)
HEX-LOGIC -Perfect Surface Polishing Pad, 6...

Features

  • works with DA DUAL ACTION POLISHERS: PORTER CABLE, UDM, FLEX POLISHERS
  • works with ALL HOOK-N-LOOP STYLE BACKING PLATES
  • works with MAKITA, DEWALT, HITACHI, MATIBO, HF HARBOR FREIGHT

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>