-4

Can any one help me please. I need to perform any operation on such type of input format:

The input is a string consisting of numbers separated by space like
10 20 200 120 50 I need to print largest number in the array. I am unable perform operations since in strings s[3] means it takes fourth value that is 2 but how to separate 10 and 20 and then compare or perform some arithmetic operation.

Arpith
  • 570
  • 2
  • 10
  • 26
  • 4
    Welcome to Stack Overflow! Please take the [tour](http://stackoverflow.com/tour) and read [How to Ask](http://stackoverflow.com/help/how-to-ask) to learn what we expect from questions here. Please be aware that we do not provide _from-scratch_ coding service here. Please show us what you've tried already, how it failed and we might be able to help.:-) – Sourav Ghosh Jun 12 '15 at 06:58

1 Answers1

-1

Here, What you can do is , you can separate the string using ' ' (Space), Store it somewhere, convert it to integer using the atoi() function and then compare.

Eregrith
  • 4,263
  • 18
  • 39
Chirag Gangdev
  • 137
  • 2
  • 2
  • 6