Active TopicsActive Topics  Display List of Forum MembersMemberlist  CalendarCalendar  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin


 One Stop Testing ForumTesting Tools @ OneStopTestingWinRunner @ OneStopTesting

Message Icon Topic: C# for testers

Post Reply Post New Topic
Author Message
ravbinz
Newbie
Newbie


Joined: 26Aug2007
Location: New Zealand
Online Status: Offline
Posts: 1
Quote ravbinz Replybullet Topic: C# for testers
    Posted: 27Aug2007 at 1:33am

 Question2

#include<iostream>

using namespace std;

class CTriangle //declaring a class//

{

double *base,*height;//declaration of two pointers////private//

public:

CTriangle(double,double);//public////declaration of the constructor//

~CTriangle();//declaration of the destructor//

double area()//method//

{

return(0.5* *base * *height);//formula to calculate the triangle area//

}

};

CTriangle::CTriangle(double b,double h)//Calling the constructor//

{

base=new double;

height=new double;

*base=b;

*height=h;

}

CTriangle::~CTriangle()//calling the destructor//

{

delete base;

delete height;

}

int main()//The main function//

{

CTriangle tria(3,4),triab(5,6);

cout<<"tria area: "<<tria.area()<<endl;//calling the method area//

cout<<"triab area: "<<triab.area()<<endl;

return 0;

}//closing the main function//

Question3

 

#include<iostream>

using namespace std;

int Daysapart(Date d1,Date d2);

{

int count=0;

Date temp;

if(d1>d2)

{

temp=d1;

d1=d2;

d2=temp;

}

assert:d1<=d2

while(!(d1==d2))

{

d1++;

count++;

}

return count;

}

int main()

{

date d1,d2;

int temp;

cout<<"Enter the first Date value:";

cin>>d1;

cout<<"Enter the second Date value:";

cin>>d2;

temp=Daysapart(d1,d2);

cout<<temp;

return 0;

}

Question4

//Name:K.Pooja//

//Student Id:20060788//

#include<iostream>

#include<fstream>

#include<iomanip>

using namespace std;

int main()

{

char myfile[100];

char newfile[100];

int i=0;

ifstream file;

file.open("exam.txt");

while(!file.eof())

{

file.getline(myfile,100);

cout<<setw(10)<<myfile;

i++;

}

file.close ();

cout<<"\n\n";

ofstream app;

app.open("exam.txt",ios::app);

app<<"Today is 9 May 2007";

app<<"Pooja is doing C++";

app.close();

ifstream file1;

file1.open("exam.txt");

while(!file1.eof())

{

file1.getline(newfile,100);

cout<<setw(10)<<newfile;

}

file1.close();

return 0;

}




Post Resume: Click here to Upload your Resume & Apply for Jobs

IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 6.570 seconds.
Vyom is an ISO 9001:2000 Certified Organization

© Vyom Technosoft Pvt. Ltd. All Rights Reserved.

Privacy Policy | Terms and Conditions
Job Interview Questions | Placement Papers | Free SMS | Freshers Jobs | MBA Forum | Learn SAP | Web Hosting