Facebook
From Bulky Motmot, 6 Years ago, written in Plain Text.
This paste is a reply to Re: Re: Untitled from Crimson Hedgehog - go back
Embed
Viewing differences between Re: Re: Untitled and Re: Re: Re: Untitled
#include 
int main(int argc, char *argv[])
{
 if(argc != 2) {
 printf("ERROR: You need one argument.\n");
 // this is how you abort a program
 return 1;
 }
 int i = 0;
 if(argc == 1) {
 printf("You only have one argument. You suck.\n");
 } else if(argc > 1 && argc < 4) {
 printf("Here's your arguments:\n");
 
for(i = 0; i < argc; argv[1][i] != '\0'; i++) {
 printf("%s ", argv[i]);
char letter = argv[1][i];
 switch(letter) {
 case 'a':
 case 'A':
 printf("%d: 'A'\n", i);
 break;
 case 'e':
 case 'E':
 printf("%d: 'E'\n", i);
 break;
 case 'i':
 case 'I':
 printf("%d: 'I'\n", i);
 break;
 case 'o':
 case 'O':
 printf("%d: 'O'\n", i);
 break;
 case 'u':
 case 'U':
 printf("%d: 'U'\n", i);
 break;
 case 'y':
 case 'Y':
 if(i > 2) {
 // it's only sometimes Y
printf("%d: 'Y'\n", i);
 }
 printf("\n");
 } else {
 printf("You have too many arguments. You suck.\n");
break;
 default:
 printf("%d: %c is not a vowel\n", i, letter);
 }
 }
 return 0;
}