Categories
Uncategorised

Pointers – Output Questions

It’s been quite some time since I posted any C++ program stuff from the DPS VK assignments for all to copy. That was because I haven’t been (and still not) studying much lately. After a few threats from the teacher though, finally got my act together and in an moment of pure frenzy updated my practical file (which, I hear, is again outdated now). Whadev. So people, you now have pointers and inheritance questions up, a demand which had been coming for a long time. File handling MAYBE coming soon. Till then, you can download the solutions of the pointers’ output questions by clicking here.

Categories
Uncategorised

Pointers – Vowels

/* Copyright (C) 2007 Ankur Banerjee. This program is free software: you can redistribute it and / or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 3 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. For a copy of the GNU General Public License see http://www.gnu.org/licenses/gpl.html /

/ Pointers – Count vowels /

#include <iostream.h>
#include <conio.h>

void main()
{
clrscr();
char word[200];
int vow = 0;
cout<<endl<<“Enter a string : “;
gets(word);
char *ptr = word;
for (int i = 0; *ptr != ”;
ptr++)
{
switch(
ptr)
{
case ‘A’ :
case ‘a’ :
case ‘E’ :
case ‘e’ :
case ‘I’ :
case ‘i’ :
case ‘O’ :
case ‘o’ :
case ‘U’ :
case ‘u’ : ++vow;
}
}
cout<<“Number of vowels in entered string is : “<<vow;
getch();
}
/* Output */

Enter a string : The quick brown fox jumped over the lazy dog
Number of vowels in entered string is : 12