Public
snipts » template
showing 1-20 of 43 snipts for template
-
∞ HTML5 boilerplate
<!DOCTYPE html> <html> <head> <meta charset=utf-8 /> <title>HTML 5 complete</title> <!--[if IE]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <style> article, aside, dialog, figure, footer, header, hgroup, menu, nav, section { display: block; } </style> </head> <body> <p>Hello World</p> </body> </html>
-
∞ jquery plugin template
;(function($) { $.fn.pluginName = function(settings) { var o = $.extend({}, $.fn.pluginName.defaults, settings); return this.each(function() { var element = $(this); // Stick your functionality here, yo.. }) } $.fn.pluginName.defaults = {} })(jQuery);
-
∞ PHP class template
<?php /** * @author 1:Carlos Pires} * @copyright Copyright (c) 2010, 2:2km interativa!} */ class ${3:nome da classe} { $end } ?>
-
∞ CakePHP view template
<div class="${1:nome do controller minusculo no plural} view"> <h2><?php __('${2:nome do modelo maiusculo no singular}');?></h2> <dl><?php $i = 0; $class = ' class="altrow"';?> <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Id'); ?></dt> <dd<?php if ($i++ % 2 == 0) echo $class;?>> <?php echo $registro['$2']['id']; ?> </dd> <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Nome'); ?></dt> <dd<?php if ($i++ % 2 == 0) echo $class;?>> <?php echo $registro['$2']['nome']; ?> </dd> </dl> </div> <div class="actions"> <ul> <li><?php echo $html->link(__('Editar $2', true), array('action'=>'edit', $registro['$2']['id'])); ?> </li> <li><?php echo $html->link(__('Delete $2', true), array('action'=>'delete', $registro['$2']['id']), null, sprintf(__('Você tem certeza que deseja apagar o registro com id %s?', true), $registro['$2']['id'])); ?> </li> <li><?php echo $html->link(__('Listar $2s', true), array('action'=>'index')); ?> </li> <li><?php echo $html->link(__('Adicionar $2', true), array('action'=>'add')); ?> </li> </ul> </div>
-
∞ CakePHP view related template
<div class="related"> <h3><?php __('Related Posts');?></h3> <?php if (!empty($tag['Post'])):?> <table cellpadding = "0" cellspacing = "0"> <tr> <th><?php __('Id'); ?></th> <th><?php __('Categoria Id'); ?></th> <th><?php __('Titulo'); ?></th> <th><?php __('Texto'); ?></th> <th class="actions"><?php __('Actions');?></th> </tr> <?php $i = 0; foreach ($tag['Post'] as $post): $class = null; if ($i++ % 2 == 0) { $class = ' class="altrow"'; } ?> <tr<?php echo $class;?>> <td><?php echo $post['id'];?></td> <td><?php echo $post['categoria_id'];?></td> <td><?php echo $post['titulo'];?></td> <td><?php echo $post['texto'];?></td> <td class="actions"> <?php echo $html->link(__('View', true), array('controller'=> 'posts', 'action'=>'view', $post['id'])); ?> <?php echo $html->link(__('Edit', true), array('controller'=> 'posts', 'action'=>'edit', $post['id'])); ?> <?php echo $html->link(__('Delete', true), array('controller'=> 'posts', 'action'=>'delete', $post['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $post['id'])); ?> </td> </tr> <?php endforeach; ?> </table> <?php endif; ?> <div class="actions"> <ul> <li><?php echo $html->link(__('New Post', true), array('controller'=> 'posts', 'action'=>'add'));?> </li> </ul> </div> </div>
-
∞ CakePHP index template
<div class="${1:nome do controler minusculo no plural} index"> <h2><?php __('${2:nome do model maiusculo no singular}');?></h2> <p> <?php echo $paginator->counter(array( 'format' => __('Página %page% de %pages%, exibindo %current% registros de %count%, iniciando no %start%, terminando no %end%', true) )); ?></p> <table cellpadding="0" cellspacing="0"> <tr> <th><?php echo $paginator->sort('ID','$2.id');?></th> <th><?php echo $paginator->sort('Nome','$2.nome');?></th> <th class="actions"><?php __('Actions');?></th> </tr> <?php $i = 0; foreach (\$$1 as \$${3:registro}): $class = null; if ($i++ % 2 == 0) { $class = ' class="altrow"'; } ?> <tr<?php echo $class;?>> <td> <?php echo \$$3['$2']['id']; ?> </td> <td> <?php echo \$$3['$2']['${4:campo}']; ?> </td> <td class="actions"> <?php echo $html->link(__('Ver', true), array('action'=>'view', \$$3['Tag']['id'])); ?> <?php echo $html->link(__('Editar', true), array('action'=>'edit', \$$3['Tag']['id'])); ?> <?php echo $html->link(__('Deletar', true), array('action'=>'delete', \$$3['Tag']['id']), null, sprintf(__('Você tem certeza que deseja apagar o registro com id # %s?', true), \$$3['$2']['id'])); ?> </td> </tr> <?php endforeach; ?> </table> </div> <div class="paging"> <?php echo $paginator->prev('<< '.__('anterior', true), array(), null, array('class'=>'disabled'));?> | <?php echo $paginator->numbers();?> <?php echo $paginator->next(__('próxima', true).' >>', array(), null, array('class'=>'disabled'));?> </div> <div class="actions"> <ul> <li><?php echo $html->link(__('Adicionar $2', true), array('action'=>'add')); ?></li> </ul> </div>
-
∞ CakePHP edit template
<div class="${1:nome do controller minusculo no plural} form"> <?php echo $form->create('${2:nome do model no singular}');?> <fieldset> <legend><?php __('Editar $2');?></legend> <?php echo $form->input('id'); echo $form->input('${3:nome do campo}'); ?> </fieldset> <?php echo $form->end('Enviar',true);?> </div> <div class="actions"> <ul> <li><?php echo $html->link(__('Deletar', true), array('action'=>'delete', $form->value('$2.id')), null, sprintf(__('Você tem certeza que deseja apagar o registro com id %s?', true), $form->value('$2.id'))); ?></li> <li><?php echo $html->link(__('Listar $2', true), array('action'=>'index'));?></li> </ul> </div>
-
∞ CakePHP add template
<div class="${1:nome do controller no plural} form"> <?php echo $form->create('${2:nome do model no singular}');?> <fieldset> <legend><?php __('Adicionar $2');?></legend> <?php echo $form->input('${3:nome do campo}'); ?> </fieldset> <?php echo $form->end(__('Enviar',true));?> </div> <div class="actions"> <ul> <li><?php echo $html->link(__('Listar ${2:nome do model no plural}', true), array('action'=>'index'));?></li> </ul> </div>
-
∞ CakePHP model template
<?php /** * @version $Revision: $ * @lastmodified $Date: $ * @author ${1:Carlos Pires} * @copyright Copyright (c) 2010, ${2:2km interativa!} */ class ${3:nome do model no singular} extends AppModel { var $displayField = '${4:nome}'; var $validate = array( $end ); } ?>
-
∞ CakePHP controller crud
<?php /** * @version $Revision: $ * @lastmodified $Date: $ * @author ${1:Carlos Pires} * @copyright Copyright (c) 2010, ${2:2km interativa!} */ class ${3:Nome do controller no plural}Controller extends AppController { var $helpers = array('Html', 'Form'); function index() { $this->${4:nome do modelo maiusculo no singular}->recursive = 0; $this->set('${5:nome do modelo minusculo no plural}', $this->paginate()); } function view($id = null) { if (!$id) { $this->_setErro(__('$4 inválida.', true)); $this->redirect(array('action'=>'index')); } $this->set('${6:registro}', $this->$4->read(null, $id)); } function add() { if (!empty($this->data)) { $this->$4->create(); if ($this->$4->save($this->data)) { $this->Session->setFlash(__('$4 salva com sucesso', true),'sucesso'); $this->redirect(array('action'=>'index')); } else { $this->Session->setFlash(__('Os dados não puderam ser salvos. Por favor, tente novamente.', true),'erro'); } } } function edit($id = null) { if (!$id && empty($this->data)) { $this->Session->setFlash (__('$4 inválida.', true),'erro'); $this->redirect(array('action'=>'index')); } if (!empty($this->data)) { if ($this->$4->save($this->data)) { $this->Session->setFlash (__('$4 alterada com sucesso', true),'sucesso'); $this->redirect(array('action'=>'index')); } else { $this->Session->setFlash(__('Os dados não puderam ser salvos. Por favor, tente novamente.', true),'erro'); } } if (empty($this->data)) { $this->data = $this->$4->read(null, $id); } } function delete($id = null) { if (!$id) { $this->Session->setFlash(__('$4 inválida.', true),'erro'); $this->redirect(array('action'=>'index')); } if ($this->$4->del($id)) { $this->Session->setFlash(__('$4 deletada.', true),'sucesso'); $this->redirect(array('action'=>'index')); } } } ?>
-
∞ CakePHP controller template
<?php /** * @version $Revision: $ * @lastmodified $Date: $ * @author ${1:Carlos Pires} * @copyright Copyright (c) 2010, ${2:2km interativa!} */ class ${3:Nome do controller no plural}Controller extends AppController { var $helpers = array('Html', 'Form'$4); function index() { $end } } ?>
-
∞ Respaldo de template de area comercial de Horizonte.cl
<?php /* Template Name: Area Comercial */ ?> <?php get_header(); ?> <?php get_sidebar(); ?> <div id="columna_izquierda" class="ancho_contacto"> <div id="contacto"> <div class="titulo"> <h1>Perfil de la radio</h1> </div> <div class="contenedor"> <p>Horizonte es una radio donde se le da énfasis a las tendencias musicales nacionales e internacionales. Donde comparten espacio los clásicos y la vanguardia. Un medio pluralista y abierto a respetar las distintas opciones de la actualidad, difundir la cultura y generar comunidades activas.</p> <p>Nuestro público objetivo está definido como hombres y mujeres entre los 20 y 34 años pertenecientes a los grupos socio económico ABC1 y C2.</p> <p>Además de la música, tenemos programas descritos a continuación:</p> </div> <br /> <div class="titulo"> <h1>Guia de Avisadores</h1> </div> <div class="contenedor"> <p><b>TARIFAS AUSPICIOS RADIO HORIZONTE </b></p> <p><b>RADIO HORIZONTE RED SATELITAL</b> transmite en Santiago 103.3 y Viña del Mar 101.1.</p> <p><b>En Radio Horizonte tenemos para nuestros clientes espacios publicitarios en forma de frases (repartidas y/o determinadas), auspicios y espacios noticiosos.</b></p> <table> <tr> <th>Tipo de Frases en Horizonte Stgo. + Regiones</th> <th>Valor Mensual</th> </tr> <tr> <td>Frase mes horario Repartido de hasta 30".</td> <td>$1.100.000 + iva.</td> </tr> <tr> <td>Frase mes horario Determinado de hasta 30". </td> <td>$1.320.000 + iva.</td> </tr> <tr> <td>Frase mes Política de hasta 30". </td> <td>$1.380.000 + iva.</td> </tr> </table> <p><b>CONDICIONES GENERALES:</b></p> <ol> <li>Segundaje: Las tarifas consideradas comprenden frases de hasta 30 segundos. Si el segundaje contratado fuera inferior a dicho tiempo, la radio no retribuirá con una mayor frecuencia la diferencia existente. Si por el contrario el segundaje supera los 30", la Radio disminuirá proporcionalmente la frecuencia contratada.</li> <li>Los valores incluyen Comisión de Agencia.</li> <li>Los valores no incluyen IVA.</li> <li>Los valores son considerados con pago a 30 días del inicio de la Publicidad.</li> <li>Se considera un descuento por pago contado.</li> <li>Los avisos solicitados en cabeza o cierre de tanda tienen un recargo del 25%.</li> </ol> </div> <br /> <div class="titulo"> <h1> Nuestros Programas </h1> </div> <div class="contenedor"> <p> <h4>CONDICIONES GENERALES</h4> <ol> <li>Segundaje: Las tarifas consideradas comprenden frases de hasta 30 seg. Si el segundaje contratado fuera inferior a dicho tiempo, la radio no retribuirá con una mayor frecuencia la diferencia existente. Si por el contrario el segundaje supera los 30", la Radio disminuirá proporcionalmente la frecuencia contratada.</li> <li>Los valores incluyen Comisión de Agencia.</li> <li>Los valores no incluyen IVA.</li> <li>Los valores son considerados con pago a 30 días del inicio de la Publicidad.</li> <li>Se considera un descuento por pago contado.</li> <li>Los avisos solicitados en cabeza o cierre de tanda tienen un recargo del 25%.</li> </ol> <hr size="1"/> <table id="fina"> <tr> <th>Programa</th> <th>Fina Seleccion</th> </tr> <tr> <td width="150"><strong>DERECHOS</strong></td> <td>Presentación y cierre con mención.<br/> 2 Frases diarias de hasta 30".<br/> 1 Mención Conductor</td> </tr> <tr> <td width="150"><strong>FRECUENCIA</strong></td> <td>De Lunes a Viernes y Domingos de 22:00 a 23:00 hrs.</td> </tr> <tr> <td width="150"><strong>VALOR MENSUAL</strong></td> <td> $ 3.000.000 + iva mensual.</td> </tr> </table> <br /> <table id="destacados"> <tr> <th>Programa</th> <th>5 Destacados</th> </tr> <tr> <td width="150"><strong>DERECHOS</strong></td> <td>Presentación y cierre con mención.<br/> 5 Frases diarias de hasta 30".</td> </tr> <tr> <td width="150"><strong>FRECUENCIA</strong></td> <td>Lunes a Domingos a las:<br /> 8.30, 11.30, 13.30, 16.30 y 19.30 hrs.</td> </tr> <tr> <td width="150"><strong>VALOR MENSUAL</strong></td> <td> $ 4.620.000 + iva mensual.</td> </tr> </table> <br /> <table id="retro"> <tr> <th>Programa</th> <th>Retro</th> </tr> <tr> <td width="150"><strong>DERECHOS</strong></td> <td>Presentación y cierre con mención de marca en 4 emisiones diarias<br /> 1 Frase diaria despues de cada micro (4 diarias)<br /> 1 Mención Conductor</td> </tr> <tr> <td width="150"><strong>FRECUENCIA</strong></td> <td>Lunes a Domingo a las:<br/> 10.00, 13.00, 15.00, 19.00 hrs.</td> </tr> <tr> <td width="150"><strong>VALOR MENSUAL</strong></td> <td> $ 4.000.000 + iva mensual.</td> </tr> </table> <br /> <table id="loop"> <tr> <th>Programa</th> <th>Loop</th> </tr> <tr> <td width="150"><strong>DERECHOS</strong></td> <td>Presentación y cierre con menció<br /> 3 Frases diaria de hasta 30"<br /> 2 Menciónes</td> </tr> <tr> <td width="150"><strong>FRECUENCIA</strong></td> <td>Sabado a las:<br/> 00.00 hrs.</td> </tr> <tr> <td width="150"><strong>VALOR MENSUAL</strong></td> <td> $ 2.500.000 + iva mensual.</td> </tr> </table> <br /> <table id="agenda"> <tr> <th>Programa</th> <th>Agenda Horizonte</th> </tr> <tr> <td width="150"><strong>DERECHOS</strong></td> <td>Presentación y cierre con mención.<br/> 5 Frases diarias de hasta 30".</td> </tr> <tr> <td width="150"><strong>FRECUENCIA</strong></td> <td>De Lunes a Domingo:<br /> 8.15, 10.15, 13.15, 16.15 y 19.15 hrs.</td> </tr> <tr> <td width="150"><strong>VALOR MENSUAL</strong></td> <td> $ 5.335.000 + iva mensual.</td> </tr> </table> <br /> <table id="tele"> <tr> <th>Programa</th> <th>Tele</th> </tr> <tr> <td width="150"><strong>DERECHOS</strong></td> <td>Presentación y cierre con mención.<br/> 1 frase después de cada micro (5 diarias)<br /> 3 frases diarias de hasta 30".</td> </tr> <tr> <td width="150"><strong>FRECUENCIA</strong></td> <td>De Lunes a Domingo a las:<br /> 9.15, 12.15, 15.15, 18.15 y 21.15 hrs.</td> </tr> <tr> <td width="150"><b>VALOR MENSUAL </th> <td> $ 5.335.000 + iva mensual.</td> </tr> </table> <br /> <table id="ticket"> <tr> <th>Programa</th> <th>Ticket</th> </tr> <tr> <td width="150"><strong>DERECHOS</strong></td> <td>Presentación y cierre con mención.<br/> 1 frase después de cada micro (5 diarias)<br /> 3 frases diarias de hasta 30".</td> </tr> <tr> <td width="150"><strong>FRECUENCIA</strong></td> <td>De Lunes a Domingo a las:<br /> 9.15, 12.15, 15.15, 18.15 y 21.15 hrs.</td> </tr> <tr> <td width="150"><b>VALOR MENSUAL </th> <td> $ 5.335.000 + iva mensual.</td> </tr> </table> <br /> <table id="version"> <tr> <th>Programa</th> <th>Versión Oficial</th> </tr> <tr> <td width="150"><strong>DERECHOS</strong></td> <td>Presentación y cierre con menció<br /> 1 Frase diaria de hasta 30"<br /> 1 Mención Conductor</td> </tr> <tr> <td width="150"><strong>FRECUENCIA</strong></td> <td>Lunes a Domingo a las:<br/> 8.00, 11.00, 14.00, 17.00 y 20.00 hrs. Resumen especial domingo a las 17.00 hrs.</td> </tr> <tr> <td width="150"><strong>VALOR MENSUAL</strong></td> <td> $ 4.620.000 + iva mensual.</td> </tr> </table> <br /> <table id="agenda"> <tr> <th>Programa</th> <th>Agenda Horizonte</th> </tr> <tr> <td width="150"><strong>DERECHOS</strong></td> <td>Presentación y cierre con mención.<br/> 5 Frases diarias de hasta 30".</td> </tr> <tr> <td width="150"><strong>FRECUENCIA</strong></td> <td>De Lunes a Domingo:<br /> 8.15, 10.15, 13.15, 16.15 y 19.15 hrs.</td> </tr> <tr> <td width="150"><strong>VALOR MENSUAL</strong></td> <td> $ 5.335.000 + iva mensual.</td> </tr> </table> <br /> <table id="tele"> <tr> <th>Programa</th> <th>Tele</th> </tr> <tr> <td width="150"><strong>DERECHOS</strong></td> <td>Presentación y cierre con mención.<br/> 1 frase después de cada micro (5 diarias)<br /> 3 frases diarias de hasta 30".</td> </tr> <tr> <td width="150"><strong>FRECUENCIA</strong></td> <td>De Lunes a Domingo a las:<br /> 9.15, 12.15, 15.15, 18.15 y 21.15 hrs.</td> </tr> <tr> <td width="150"><b>VALOR MENSUAL </th> <td> $ 5.335.000 + iva mensual.</td> </tr> </table> <br /> <table id="ticket"> <tr> <th>Programa</th> <th>Ticket</th> </tr> <tr> <td width="150"><strong>DERECHOS</strong></td> <td>Presentación y cierre con mención.<br/> 1 frase después de cada micro (5 diarias)<br /> 3 frases diarias de hasta 30".</td> </tr> <tr> <td width="150"><strong>FRECUENCIA</strong></td> <td>De Lunes a Domingo a las:<br /> 9.15, 12.15, 15.15, 18.15 y 21.15 hrs.</td> </tr> <tr> <td width="150"><b>VALOR MENSUAL </th> <td> $ 5.335.000 + iva mensual.</td> </tr> </table> <br /> <table id="horarias"> <tr> <th>Programa</th> <th>Señales Horarias</th> </tr> <tr> <td width="150"><strong>DERECHOS</strong></td> <td>Presentación (9 diarias)<br/> 9 frases diarias de hasta 30".</td> </tr> <tr> <td width="150"><strong>FRECUENCIA</strong></td> <td>De Lunes a Domingo.</td> </tr> <tr> <td width="150"><b>VALOR MENSUAL </th> <td> $ 5.335.000 + iva mensual.</td> </tr> </table> <br /> <table id="temperatura"> <tr> <th>Programa</th> <th>Señales de Temperatura</th> </tr> <tr> <td width="150"><strong>DERECHOS</strong></td> <td>Presentación (9 diarias)<br/> 9 frases diarias de hasta 30".</td> </tr> <tr> <td width="150"><strong>FRECUENCIA</strong></td> <td>De Lunes a Domingo.</td> </tr> <tr> <td width="150"><b>VALOR MENSUAL </th> <td> $ 5.335.000 + iva mensual.</td> </tr> </table> </div> <br /> <div class="titulo"> <h1>Contacto Comercial</h1> </div> <div class="contenedor"> <p>El Departamento Comercial de Radio Horizonte, opera en: <br/> Av. Pocuro 2151 comuna de Providencia - Santiago.</p> <p> <strong>EJECUTIVO COMERCIAL<br />SERGIO HERNANDEZ</strong><br /> Teléfono: 4105431<br/> E-Mail: <a href="mailto:shernandez@horizonte.cl">shernandez@horizonte.cl</a> </p> <p>Para cualquier consulta, duda o información respecto de la disponibilidad de espacios y/o programación en la Radio, nuestro Departamento Comercial atenderá oportunamente tales inquietudes.</p> </div> </div> </div> <?php get_footer(); ?>
-
∞ Template(return value)
#include <iostream> using namespace std; template <typename T> T calArea (T &b,T &l) { int area; area= b* l; return area; } template <typename T> T calvolume (T &area,T &w) { int vol; vol=area * w; return vol; } //template <typename T> int main() { int breadth=10; int length=20; double width=10; double area=calArea(breadth,length); double volume=calvolume(area,width); cout<<"Area is :"<<area<<endl<<endl; cout<<"Volume is :"<<volume<<endl; } -
∞ template - using 2 Ts
#include <iostream> using namespace std; template<typename T1, typename T2> //T1 for 'double' type variables, T2 for 'integer' type variables void CalArea(T2 * pHeight, T2 * pWidth, T1 * pArea) { *pArea = (*pHeight) * (*pWidth); // double = integer * integer } template<typename T1, typename T2> //T1 for 'double' type variables, T2 for 'integer' type variables void CalVolume(T1 * pVolume, T2 * pLength, T1 * pArea) { *pVolume = (*pArea) * (*pLength); //double = double * integer } int main() { double volume = 0; double area = 0; int height = 5; int width = 5; int length = 10; double * pArea; double * pVolume; int * pHeight; int * pWidth; int * pLength; pArea = &area; pVolume = &volume; pHeight = &height; pWidth = &width; pLength = &length; CalArea(pHeight, pWidth, pArea); CalVolume(pVolume, pLength, pArea); cout << "The Area is: " << *pArea << endl; cout << "The Volume is: " << *pVolume << endl; return 0; }
-
∞ template
#include <iostream> using namespace std; template<typename T> T calcarea(T &W,T &H,T &area) { area=W*H; return area; } template<typename T> T calcvolume(T &area,T &L,T &volume) { volume=area*L; return volume; } int main() { int W=2; int H=3; int L=4; int area=0; int volume=0; cout<<"area:"<<calcarea(W,H,area)<<endl; cout<<"volume:"<<calcvolume(area,L,volume)<<endl; return 0; }
-
∞ Template - pass by reference.
//Template - pass by reference. #include <iostream> using namespace std; template<typename T> T Area(T *x,T *y) { T z= *x * *y; return z; } template<typename T> T volume(T *u, T *v) { T w= *u * *v; return w; } int main() { int *ph; int *pw; double *pl; int h = 2; int w = 10; double l = 5.74; ph = &h; pw = &w; pl = &l; Area(&h,&w); double calcArea = Area(&h,&w); volume( &calcArea, &l); cout << "Height is : "<< h << " width is : "<< w << " . " <<" Area calculated is : "<< Area(&h,&w) << endl; cout << "area is : "<< Area(&h,&w) << " length is : "<< l << " . " <<" Volume calculated is : "<< volume(&calcArea,&l) << endl; return 0; }
-
∞ template pass by reference
#include <iostream> using namespace std; template <typename T> T calArea (T *h,T *l) { T area= *h * *l; return area; } template <typename T> T calvolume (T *area,T *w) { T vol=*area * *w; return vol; } //template <typename T> int main() { int *ptrh; int *ptrl; double *ptrw; int l=3; int h=5; double w=6.0; double area; double vol; ptrh= &h; ptrl= &l; ptrw= &w; calArea(&h,&l); area=calArea(&h,&l); cout<<"The area is :"<<calArea(&h,&l)<<endl; calvolume(&area ,&w); cout<<"The volume is :"<<calvolume(&area ,&w)<<endl; }
-
∞ template(value)
#include <iostream> using namespace std; //double CalArea(double h, double w); //double CalVol(double area, double l); template <typename T> T CalArea(T h, T w) { T area; area = h*w; return area; } template <typename T> T CalVol(T area, T l) { T vol; vol = area*l; return vol; } int main() { double h, w, l; double area, vol; // int h, w, l; // int area, vol; cout << "Height = " ; cin >> h; cout << "Width = " ; cin >> w; cout << "Length = " ; cin >> l; area = CalArea(h, w); vol = CalVol(area, l); cout << "\nArea = " << area << endl; cout << "Volume = " <<vol << endl; return 0; }
-
∞ template2
#include <iostream> using namespace std; //void calArea(int h, int w, int &area); //void calVol(int area, int l, int &ptrVol); template <typename T> void calArea(T h, T w, T &area) { area = h * w; } template <typename T> void calVol(T area, T l, T &vol) { vol = area * l; } int main() { double h ; double w ; double l ; double area; double vol; /* int h ; int w ; int l ; int area; int vol; */ // int *ptrArea; // int *ptrVol ; // ptrArea = &area; // ptrVol = &vol; cout<<"enter h: "; cin>>h; cout<<"enter w: "; cin>>w; cout<<"enter l: "; cin>>l; calArea(h, w, area); calVol(area, l, vol); cout << "Area = " << area << endl; cout << "Volume = " << vol<< endl; return 0; }
-
∞ tempate
#include <iostream> using namespace std; template<typename T> T CalArea(T &h, T &w) { T area=h * w; return area; } template<typename T> T CalVol(T &h,T &l, T &w) { T vol=h* l* w; return vol; } int main() { int h=1; int w=2; int l=3; cout << "Area is" <<CalArea(h, w)<<endl; cout << "Volume is "<< CalVol(h, l, w) <<endl; return 0; }



Programming in Python 3