Solved Assighnments
AIOU |
Course:Data structure (3408)
Level: B.S (CS) Semester: Spring, 2015
Total Marks: 100 Pass Marks: 50
ASSIGNMENT No.1
Q:3 write an algorithm to reverse a string
“ P A K I S T A N” by using Queue or Stack data structure.
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
char str[] = "PAKISTAN";
char temp;
int i;
cout<<"Input String: "<<str<<endl;
for(i=0;i<strlen(str)/2;i++)
{
temp=str[i];
str[i]=str[strlen(str)-i-1];
str[strlen(str)-i-1]=temp;
}
cout<<"Reversed String: "<<str;
return 0;
}
click here to read other answers of assihnment 1 and 2
http://educational-wealth.blogspot.com/2015/07/assignment-data-structure-course-outline.html
Post a Comment