#include #include using namespace std; void q1(float,float&, float& ); const float pi = 3.14; void main() { float r; cout << "Radius="; cin >> r; float area, per; q1(r, per, area); cout << area << ", " << per; _getche(); system("cls"); main(); } void q1(float r, float &per, float &area) { area = pi*r*r; per = 2 * pi*r; }
#include using namespace std; #include #include<string> void GetCount(string s, int* countUpperLetters, int* countSmallLetters) { for (int i = 0; i < s.length(); i++) { if (s[i] >= 'A' && s[i] <= 'Z') *countUpperLetters = *countUpperLetters + 1; else if (s[i] >= 'a' && s[i] <= 'z') *countSmallLetters = *countSmallLetters + 1; } } void main() { int *count1 = new int; int *count2 = new int; *count1 = 0; *count2 = 0; string s = "M. Umar Zafar"; GetCount(s, count1, count2); cout << *count1 << ", " << *count2; _getche(); }
#include
#include void avg(int*a); using namespace std; void main() { int a[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; avg(a); _getche(); system("cls"); main(); } void avg(int *a) { int sum = 0; for (int i = 0; i < 10; i++) { sum += a[i]; } sum /= 10; cout << sum; }
#include #include using namespace std; #include<string> void GetCount(string s, int* counta, int* counte ,int* counti,int* counto,int* countu) { cin >> s; for (int i = 0; i < s.length(); { if (s[i] =='a') *counta = *counta else if (s[i] == 'e') *counte = *counte else if (s[i] == 'i') *counti = *counti else if (s[i] == 'o') *counto = *counto else if (s[i] == 'u') *countu = *countu } } void main() { int *counta = int *counte = int *counti = int *counto = int *countu = *counta = 0; *counte = 0; *counti = 0;
new new new new new
int; int; int; int; int;
i++)
+ 1; + 1; + 1; + 1; + 1;
*counto = 0; *countu = 0; string s; GetCount(s, counta, counte,counti,counto,countu); cout << *counta << "," << *counte << " , " << *counti <<" , "<<*counto<<" , "<<*countu; _getch(); }