Questions tagged as 'c'

2
answers

Does not display the string, in C

I'm having trouble copying string in C, this does not want to work. #include <stdio.h> #include <stdlib.h> int main() { int count; char str1[20] = "Hello World", str2[20]; for(count = 0; str1[count]!='#include <stdi...
asked by 17.05.2015 / 19:28
1
answer

Difficulty with triangular number program [duplicate]

I'm having trouble creating a program that prints if the number you typed is triangular or not. How do I proceed to create an indefinite sequence for a large number within the conditional? #include <stdio.h> int main (void) { int...
asked by 20.04.2015 / 03:01
1
answer

Erase specific line of a text file

I need to delete the last line of a text file. It stores the user's coordinates for each line, but when the user requests a ctrl + z , I need to delete the last line. How can I do this?     
asked by 25.04.2015 / 10:22
2
answers

How can I complete the harmonic average?

I would like to know why my code is not returning the correct values, because when I type the value it does not calculate correctly, like entering two notes, both being and 5.0 , the output should be 5.0 and this is not happening. Use the...
asked by 02.05.2015 / 03:05
1
answer

Problem in function sup

I'm here with a problem in this function int sup (char s1 [], char s2 []) , that calculates the largest suffix size of s1 that is prefixed to s2. / strong> For example, if you have supre ("cheat", "totality") it should return 4 , since the st...
asked by 21.03.2015 / 16:44
1
answer

Stream corrupts when being saved

I have the algorithm that simulates a type of register, but when I save the file the fields, street, city and state are lost, they simply disappear, and as I am saving it it corrupts the file already at the time of writing. I can not figure out...
asked by 26.11.2014 / 04:55
1
answer

Error unknown type name

I'm trying to pass a typedef struct as a parameter to a function but gives the error: "bib.h: 6: 13: error: unknown type name 'array'" Here is the code: #include "bib.h" typedef struct { int matriz[N][N]; }matriz; void gerarMatriz(matriz...
asked by 08.12.2014 / 22:01
1
answer

Sequence of fraction with fibonacci and primes

h. Ask the user how many terms he wants and print out the sequence below and    sum of terms.     1 + 1 + 2 + 3 + 5 + 8 + ...     2 3 5 7 11 13    * above Fibonacci sequence and below sequence of Cousins. I have this exercise to do, but I can...
asked by 14.10.2014 / 03:30
1
answer

How to check the winner in the old game [closed]

I'm playing an old game in C, I want to know how to check which player won by checking horizontal and vertical lines and diagonals. Here is my program done so far: #define tam 3 void desenhaTabuleiro(char M[tam][tam]); void zeraTabuleiro...
asked by 31.08.2014 / 02:49
1
answer

Convert C ++ to C # [closed]

Well, I'm passing some code that I have, and I'm sure I can pass this code to C #, and I wanted the help of anyone who can help, in the following code below #include <dirent.h> #include <cstdlib> #include <iostream> #include...
asked by 03.09.2014 / 00:27