Monthly Archives: February 2016

Some string functions

puts()

in c i will implement.
Main job of this function is to print a new line autoamtically where printf() does not give this.

example:

putchar()

The actual work of putchar is it display string as character by character putchar is a macro that outputs character on stdout.

and the basic is : putchar(‘a’)    // it will print a
and putchar(a);     //it will print the value in stored in a
And the basic parameters of this is:
int putchar(int c);

Take input in string:

In string we don’t mention ampersand & sign as string automatically take it as address.

catcpy.c

String equality:

String Lower:

String Upper:

strdup.c

strstr.c

 

 

Reference for some examples:
http://fresh2refresh.com/c-programming/c-strings/

http://www.apiexamples.com/c/string/strstr.html

UVA Solutions 10055 – Hashmat the Brave Warrior

Note: You have to take long long as it is wanted in the description 2^32

SPOJ Solution – TEST – Life, the Universe, and Everything

 

UVA 11479 – Is this the easiest problem?

Accepted code:

I have tested with some critical input after implementing the first logic and also read the condition for testcases .It is very important to make it accepted.

Critical input:
4
100 200 300
500 501 502
1000000000 1000000001 1000000002
963 852 741

Critical output:
Case 1: Invalid
Case 2: Scalene
Case 3: Scalene
Case 4: Scalene

Uva Solution – 10783 Odd Sum

Code:

 

Uva 12577 – Hajj-e-Akbar

 

Uva 1124 – Celebrity jeopardy

 

URI Online Judge Solution | 1332 One-Two-Three | UVA 12289

Reference: https://github.com/deniscostadsc/playground/blob/master/uri/1332/1332.cpp
Code:

Editorial:

Here we have to think like a child :D….So first we took a character array where we will take input string.And if the input is = 5 then it will print three as per the input set.And then when we enter the value input like ‘t’ and ‘o’ and ‘w’ then we can make it out from the string.So we have added this like this if t and w or if t or o or w or o is available then we will print 2 in the output where in string array t in the position 1, w is in the position 2, o is in the position 3

So basically the output case 2 we made the condition in the logic.

Note: In logic we must have to follow the sequence of the text One,Two,Three as suppose in two it can be two,too,ooo,owo  and as the input will do at most 100 words.So this steps has been taken 🙂

Some Useful Android Fix

Create Credits Screen in Android

Basic SQLite C.R.U.D operation in Android

Sending data back to parent activity

Action with Action Bar or Title Bar

http://www.androidhive.info/2013/11/android-working-with-action-bar/

http://www.vogella.com/tutorials/AndroidActionBar/article.html
http://developer.android.com/guide/topics/resources/string-resource.html#FormattingAndStyling