Upload
diana-esther
View
222
Download
0
Embed Size (px)
Citation preview
7/25/2019 Ejemplos de Argv Lenguaje C
1/9
argv-0.c
/**1.
* argv-0.c2.
*3.
* David J. Malan4.
*6.
* Prints program's first command-line argument; assumes it's present.7.
*8.
* Demonstrates use of argv.9.*/10.
11.
#include 12.
#include 13.
14.
intmain(intargc,string argv[])15.
{16.
printf("%s\n",argv[1]);17.
}18.
7/25/2019 Ejemplos de Argv Lenguaje C
2/9
argv-1.c
/**1.
* argv-1.c2.
*3.
* David J. Malan4.
*6.
* Prints command-line arguments, one per line.7.
*8.
* Demonstrates use of argv.9.*/10.
11.
#include 12.
#include 13.
14.
intmain(intargc,string argv[])15.
{16.
// print arguments17.
for(inti =0;i
7/25/2019 Ejemplos de Argv Lenguaje C
3/9
argv-2.c
/**1.
* argv-2.c2.
*3.
* David J. Malan4.
*6.
* Prints command-line arguments, one character per line.7.
*8.
* Demonstrates argv as a two-dimensional array.9.*/10.
11.
#include 12.
#include 13.
#include 14.
15.
intmain(intargc,string argv[])16.
{17.
// print arguments18.
for(inti =0;i
7/25/2019 Ejemplos de Argv Lenguaje C
4/9
doors-0.html
1.
2.
3.
4.
5.
6.
7.
$(function() {8.
$('.door').click(function() {9. $(this).removeClass('closed');10.
});11.
});12.
13.
14.
15.
16.
body {17.
background-color: #000;18.
}19.
20.
.closed {21.
background-color: #fff;22.
}23.
24.
.door {25.
color: #fff;26.
font-family: sans-serif;27.
font-size: 60px;28.
font-weight: bold;29.
height: 150px;30.
padding-top: 50px;31.
margin: 20px;32.
text-align: center;33.
width : 100px;34.
}35.
36.
37.
doors-038.
39.
40.
41.
42.
1543.
2344.
1645.
846.
4247.
5048.
7/25/2019 Ejemplos de Argv Lenguaje C
5/9
doors-0.html
449.
50.
51.
52.
53.
7/25/2019 Ejemplos de Argv Lenguaje C
6/9
doors-1.html
1.
2.
3.
4.
5.
6.
7.
$(function() {8.
$('.door').click(function() {9. $(this).removeClass('closed');10.
});11.
});12.
13.
14.
15.
16.
body {17.
background-color: #000;18.
}19.
20.
.closed {21.
background-color: #fff;22.
}23.
24.
.door {25.
color: #fff;26.
font-family: sans-serif;27.
font-size: 60px;28.
font-weight: bold;29.
height: 150px;30.
padding-top: 50px;31.
margin: 20px;32.
text-align: center;33.
width : 100px;34.
}35.
36.
37.
doors-138.
39.
40.
41.
42.
443.
844.
1545.
1646.
2347.
4248.
7/25/2019 Ejemplos de Argv Lenguaje C
7/9
doors-1.html
5049.
50.
51.
52.
53.
7/25/2019 Ejemplos de Argv Lenguaje C
8/9
hello-3.c
/**1.
* hello-3.c2.
*3.
* David J. Malan4.
*6.
* Says hello to argv[1].7.
*8.
* Demonstrates a command-line argument.9.
*/10.
11.
#include 12.
#include 13.
14.
intmain(intargc,string argv[])15.
{16.
printf("hello, %s\n",argv[1]);17.
}18.
7/25/2019 Ejemplos de Argv Lenguaje C
9/9
hello-4.c
/**1.
* hello-4.c2.
*3.
* David J. Malan4.
*6.
* Says hello to argv[1].7.
*8.
* Demonstrates a non-0 return value from main.9.
*/10.
11.
#include 12.
#include 13.
14.
intmain(intargc,string argv[])15.
{16.
if(argc ==2)17.
{18.
printf("hello, %s\n",argv[1]);19.
return0;20.
}21.
else22.
{23.
return1;24.
}25.
}26.