Program to check whether a word starts with a capital
letter or not.



Program to check whether a word starts with a capital letter or not...

Answer / zaideeabu

// Untested possible answer
// Which perhaps combined C & C++ style :P

#include <iostream.h>
#include <string.h>

int main(int argc, char * argv[])
{
char cA = 'A';
char cZ = 'Z';

char str[1024] = {0};

strncpy(str, argv[1], 1024);

if ( str[0] <= cA || str[0] >= cZ )
cout << "String: " << str << " does not start with
capital letter." << endl;
else
cout << "String: " << str << " starts with capital
letter."

return 0;
}

Is This Answer Correct ?    4 Yes 3 No

Post New Answer

More OOPS Interview Questions

Program to print 0 to 9 in cross order

3 Answers  


What is a friend function & its advantage?

2 Answers   TCS,


difine hierarchical inheritance.

9 Answers   ASD Lab, TCS,


What is static in oop?

0 Answers  


what is the difference between ERROR and EXCEPTION?

14 Answers   NIIT, nvidia,






How to execute business logic for only once ..?even though user clicks submit button multiple times by mistake..? (i disabled JavaScript)

1 Answers  


Can bst contain duplicates?

0 Answers  


What is polymorphism what is it for and how is it used?

0 Answers  


what is the difference b/w abstract and interface?

2 Answers   Merrill Lynch, Schneider, Scio Healthcare,


1.explicit call for destructor 2.calling function inside a constructor. 3.base *b-new derived delete b; 4.delete p what it will delete. 5.size of base class and derived class int i,in base class and int j in derived. 6.int i-20 int main() { int i =5; printf("%d".::i); { int i =10; printf("%d".::i); } } 7.object slicing 8.new 9.function overloading(return type). 10.class base() { virtuval fun() { ----- } } class derivied:public base() { fun() { ----- } } int main() { derived d; } 11.how static function will call in C++? 12.default structures are in C++? 13.constructors should be in public . 14.virtuval constructor not exist. 15.multilevel inhritence. destructor order.

1 Answers   Tech Mahindra,


Why do we use class?

0 Answers  


What is for loop and its syntax?

0 Answers  


Categories