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 |
Why do we use polymorphism in oops?
What is pure oop?
what type of question are asked in thoughtworks pair programming round ?
What is a function in oop?
what does exactly the linker do?
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 :( :-?
what is the difference between class and structure in C++?
why in java first invoke public static void main(String args[]) method????Why not public static void method1(String args[])??
You have one base class virtual function how will call that function from derived class?
what is static?
What is inheritance in simple words?
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??