Lab 12 Pf.docx

  • Uploaded by: Fahad Mkhan
  • 0
  • 0
  • December 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Lab 12 Pf.docx as PDF for free.

More details

  • Words: 359
  • Pages: 3
#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(); }

Related Documents

Lab 12
June 2020 12
Lab 12
June 2020 11
Lab 12
November 2019 23
12-lab-01
July 2020 8
Lab 12 Dissovled Oxygen
November 2019 25

More Documents from "S. Spencer"

Cover Page.docx
December 2019 18
Lab 12 Pf.docx
December 2019 14
Pak Study.docx
December 2019 42
Lca-lab2.docx
December 2019 18
Forex Ims
June 2020 15