Give me some challenge!!!

+2 Nishant Tadvi · December 29, 2014
Plz give me some new challenge. I have completed whole tutorials. So i want some challenge. If you have then give me i would like to make a new program. thx!!!! 

Post a Reply

Replies

- page 1
Oldest  Newest  Rating
0 c student · December 29, 2014
i have a challenge for you.  this task is called a frequency analysis and what i challenge you to do is to create a program which counts all of the letters in a given text file, that is, both upper and lower cases are counted separately.   i will show you what i mean.

this is a sample of my text file:
http://i.imgur.com/cwJ9j48.png

and here is my result (note: you will need to pass in a text file as i have shown: [your program] < [your text file]):
http://i.imgur.com/SdiyLzz.png

good luck
0 Nishant Tadvi · January 1, 2015
thx for giving challenge I will soon try it and give result.
0 Nishant Tadvi · January 1, 2015
thx for giving challenge I will soon try it and give result.
0 Dinar Dude · January 2, 2015
Here are some challenges you could try: http://www.reddit.com/r/dailyprogrammer
0 Doina Doinitza · January 3, 2015
I did the letter counting challenge above but I don't know  how I can pass the file like he said "(note: you will need to pass in a text file as i have shown: [your program] < [your text file])" Can someone tell me how to do it?
0 c student · January 4, 2015
you will need to locate the directory you saved your program in

if you are on windows:
in that folder, shift-right-click on white space and click "Open command prompt here", then proceed to type in the following:
[your program name] < [your text file name]

note that they must be in the same folder and must include the extension as well, such as .txt if there is one.

if you are on mac/linux:
open terminal, change your working directory into the directory of your saved program using the cd command, then type the following:
./[your program name] < [your text file name]

again, note that they must be in the same folder and must include the extension as well, such as .txt if there is one.
0 Doina Doinitza · January 4, 2015
got it. thx
0 Darsh Patel · January 17, 2015
Can you make it and reply me that source code on this page?
0 hilmi kumdakçı · January 22, 2015
http://thedailywtf.com/series/bring-your-own-code

here you can find another challenges
0 Lazar Bulic · January 24, 2015
And here is the answer: 


#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define SIZE 26
#define MAX_SIZE 1000

main(int argc, char *argv[]){
    char str[MAX_SIZE], *s;
    int lower[SIZE-1], upper[SIZE-1], *l, *u, n = SIZE;
    l = lower;
    u = upper;
    FILE *open;

    open = fopen(argv[1], "r");
    if(open == NULL){
        printf("File wasn't opened correcty!");
        return 1;
    }
    while(n--){
        *l++ = 0;
        *u++ = 0;
    }

    while(fscanf(open,"%s",str) != EOF){
            s = str;
            while(*s != NULL){
            if(isupper(*s))
                upper[(int)*s - 'A']++;
            if(islower(*s))
                lower[(int)*s - 'a']++;
            s++;
            }
    }
    for(n=0; n<SIZE; n++){
        printf("%c: %d %c: %d\n", n + 'a', lower[n], n + 'A', upper[n]);
    }
    return 0;
}
  • 1
  • 2

C

131,214 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator