For the purpose of the grade assigned to the resolution of exercises throughout the semester, the exercises you can submit from this class are the following exercises, which are part of the set of exercises from the last two practical classes:
Submission deadline: March 31 (submit on the Imperative Programming Mooshak)
You are encouraged to talk with the instructors and other colleagues if you encounter difficulties. However, any direct help you receive from colleagues should be acknowledged in the comments of the program you submit.
After the deadline, the problems will remain available on Mooshak, but submissions will no longer count toward your grade.
Each class accounts for 10% of the grade for this component.
For a problem to count, you must pass all the tests (i.e., get accepted). Even if you solve all the problems, the maximum score per class is 100%.
To achieve 100%, it will always be sufficient to solve the main exercises.
p = i;
*p = i;
p = &q;
p = &i;
&i = p;
p = q;
p = *q;
*p = q;
*p = *q;
printf("%d",i);scanf("%d",i);scanf("%d",&i);printf("%d",p);printf("%d",*p);scanf("%d",p);printf("%p",p);printf("%p",i);printf("%p",*p);int a[] = {5, 15, 34, 54, 14, 2, 52, 72};
int *p = &a[1], *q = &a[5];
middle = (low + high) / 2;
void storezeros(int a[], int n){
int i ;
for (i= 0; i < n; i++)
a[i]= 0 ;
}
int sumTwoDimensionalArrays(const int a[][LEN], int n) {
int i, j, sum = 0;
for (i= 0 ; i < n; i++)
for (j= 0; j < LEN; j++)
sum += a[i][j] ;
return sum;
}
void decompose(int totalSecs, int *hours, int *mins, int *secs);Given the total of seconds totalSecs, an integer, the function must decompose it into hours, minutes (0-59) and seconds (0-59); the result values must be assigned to the contents of the pointers hours, mins and secs. You can assume that the total number of seconds is greater than zero.
void twoLargest(int vec[], int size, int *pmax1, int *pmax2);Given a sequence of integers represented by array vec[] with size size, the function must determine the two largest values in the sequence; the results must be assigned to the positions pointed to by pmax1 and pmax2. You can assume that size is always greater than one.
void reverse(char *str);
char *occursAt(char *str, char ch);The result should be a pointer to the first occurrence of the ch character (if it occurs) or
char *strcat(char s1[], char s2[]);which concatenates the string s2 to s1 and returns the address of the first string.
char *strcpy (char *dest, char source[]);which copies the string source to the string dest and returns the value of the latter.
int strcmp(char s1[], char s2[]);which compares (lexicographically) two strings. The result of the function should be as follows:
char *strstr(char s1[], char s2[]);which determines the position where the string s2 occurs in the string s1. The function should return NULL if s2 does not occur in s1.
void truncW(char text[], int n);Given a string text composed by several words (words are separated by one or more spaces) and an integer n, the function truncates all words so that each word has at most n characters.
char text[] = "university, faculty and fraternity" truncW(text, 4); // text becomes "univ facu and frat"Note that the word "and" has only 3 characters (3 < 4) and so it remains unaltered (i.e. it isn't truncated).
int remConsecutives(char s[]);in which given a string s as input, it outputs the length of a substring with all repeated characters removed.
int result = remConsecutive("aabcccaac"); // outputs 3, which corresponds to substring "abc"
int triSup(int N, float m[N][N]);that verifies if a given square matrix is upper triangular, that is, all elements below the diagonal are zeros.