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

Why do we use polymorphism in oops?

0 Answers  


What is pure oop?

0 Answers  


what type of question are asked in thoughtworks pair programming round ?

0 Answers   Thought Works,


What is a function in oop?

0 Answers  


what does exactly the linker do?

1 Answers  






where is memory for struct allocated? where is memory for class-object allocated? I replied for struct in stack and for class-object in heap. THen he asked if class has struct member variable what happens.class on heap and what about struct in that class? couldnt ans :( :-?

2 Answers   Infosys, Microsoft,


what is the difference between class and structure in C++?

9 Answers   Aspire, IBS, TCS,


why in java first invoke public static void main(String args[]) method????Why not public static void method1(String args[])??

1 Answers  


You have one base class virtual function how will call that function from derived class?

4 Answers  


what is static?

4 Answers  


What is inheritance in simple words?

0 Answers  


When a private constructer is being inherited from one class to another class and when the object is instantiated is the space reserved for this private variable in the memory??

13 Answers   HCL, Honeywell,


Categories