Write down a program that outputs 10 times the name passed as a parameter at command line invocation.
the_owl@eniac:~$ ./repeat "what does the fox say?"Escribir un programa que repita 10 veces el nombre anexado en la invocación de la linea de comandos.
Calculate the mean of 10 numbers given by the user.
Calcular la media de 10 números proporcionados por el usuario.
Ask numbers while the user introduces something greater or equal to 0. Show the mean of the given numbers.
Calcular la media de todos los números introducidos por el usuario. Se tomarán todos los números hasta que se introduzca algo menor que 0. El último número no se tomará en cuenta.
Given the height, build a triangle as in the example with the character provided in the invocation.
l = 4
*
**
***
****
the_owl@eniac:~$ ./trinagle "*"Complete the following program in order to print the list of words.
int main() {
const char *list[] = {
"bread",
"toast",
"bacon"
};
}Find the way (using sizeof operator) to print the number of words defined in the list.
Write a program that outputs the border of a square, given the height, like in the example:
When h=4
****
* *
* *
****
When h=7
*******
* *
* *
* *
* *
* *
*******
Define a function with the following signature:
double add(double, double);Function main shall fetch operands from command line.
the_owl@eniac:~$ ./add 2.3 5.8Arrange the main function of problem number 07 to accept a variable number of arguments.
Write a program to raise N numbers to the power of two.
#define N 0x10
int power(int base, int exponent) {
}
void fill_in(int list[N], ...) {
}
int main(...) {
int list[N];
fill_in(list, ...);
}the_owl@eniac:~$ ./raise_to 3
# => 1 8 27 ....Print a string backwards.
int main(...) {
const char *sentence = "The world is a vampire.";
const char *beginning = sentence;
const char *end = sentence;
/* Move end to the last byte in sentence*/
/* print from end to beginning */
}the_owl@eniac:~$ ./print_backwards
# => .eripmav a si dlrow ehTPrint sorted. strcmp.
int main(...) {
const char *list[] = { "yield", "yelp"};
Print sorted. strcmp.
int main(...) {
const char *list[] = { "yield", "yelp", "yellow"};
A given number is prime when is not is divided by the lower primes. Find the 70 first primes.
#define N 70
int main() {
int primes[N];
primes[0] = 2;
int primes_found = 1;
int possible_prime = 3;
/* Check the primality of the possible_prime and go for the next */
return EXIT_SUCCESS;
}Sort this array.
int main(){
int A[] = {22, 3, 77, 50, 40, 23, 37, 35, 22, 2, 61, 71, 0};
}Calculate recursively the product of the N first Natural numbers.
Solve excercise number 10 using recursion.
Calculate the continous fraction of n with 10 levels of recursion.
Add the serie that yields e.
#include <iostream>
using namespace std;
int a = 1;
int f(int a) { return a; }
int g(int x = f(a)) { return x; }
int h() {
a = 2;
{
int a = 3;
return g();
}
}
int main() {
cout << h() << endl;
}
