Skip to main content

Posts

Showing posts from May, 2013

C++ program to calculate compound interest by simple interest

#include<iostream.h> #include<conio.h> void main() { long float interest, prince, rate, amt; int time, temp, r; char choice; do { clrscr (); cout<<"PLEASE ENTER THE PRINCIPAL AMOUNT : "; cin>>prince; cout<<"\nENTER THE RATE OF INTEREST : "; cin>>rate; cout<<"\nENTER THE TIME : "; cin>>time; amt=prince; cout<<"\n\tTIME\tSIMPLE INTEREST\tAMOUNT"; for(r=8, temp=0,interest=0;temp<=time;temp++, r++) { cout<<"\n\t"<<temp<<"\t"<<interest; gotoxy(33,r); cout<<amt; interest=(amt*rate)/100; amt=amt+interest; } cout<<"\n\tClosing"<<"\t"<<interest; cout<<amt; cout<<"\n\nTHUS, THE FINAL AMOUNT IS : "<<amt; cout<<"\n\nREPEAT? (y/n) : "; cin>>choice; if(choice=='n'||choice=='N') cout<<"\nTHANK YOU"; getch(); }while(choice=='y'|...

C++ program to print Fibonacci series

#include<iostream.h> #include<conio.h> void main() { /*FIBONACCI SERIES */ char choice; do { clrscr(); long double num, a=1, b=0, count; cout<<"ENTER THE NUMBER OF ELEMENTS REQUIRED : "; cin>>num; cout<<"\n\n"; for(count=1; count<=num/2;count++) { a+=b; cout<<b << "\t"; b+=a; cout<<a << "\t"; } cout<<"\n\nREPEAT THE SAME PROGRAM? (Y/N) : "; cin>>choice; }while(choice=='y'||choice=='Y'); } OUTPUT a) ENTER THE NUMBER OF ELEMENTS REQUIRED : 8 0 1 1 2 3 5 8  13 REPEAT THE SAME PROGRAM? (Y/N) : y

C++ program to find the roots of a quadratic equation.

Technorati Tags: c++ , quadratic equation , c++ examples #include<iostream.h> #include<conio.h> #include<math.h> #include<process.h> void main() { float a,b,c,root1,root2,delta; char choice; do { clrscr(); cout<<"ENTER THE VALUES FOR THE VARIABLESIN EQUATION : ax^2 + bx + c :"; cout<<"\nENTER a : "; cin>>a; cout<<"\nENTER b : "; cin>>b; cout<<"\nENTER c : "; cin>>c; if(!a) { cout<<"\nINVALID ENTRYFOR a."; exit(0); } delta=(b*b)-(4*a*c); if(delta<0) cout<<"\nIMAGINARY ANDCOMPLEX ROOTS."; else if (delta>0) { root1=(-b+sqrt(delta))/(2*a); root2=(-b-sqrt(delta))/(2*a); cout<<"\nROOTS ARE REAL AND UNEQUAL."<<endl; cout<<"\nROOTS ARE : "<< root1 << "\t" <<root2; } else if(delta==0) { root1=(-b/(2*a)); root2=root1; cout<<"\nROOTS ARE REAL AND EQUAL."<<endl; co...

C++ program to find greatest of three numbers

c++ program to find greatest of three numbers #include<iostream.h> #include<conio.h> void main() { int a, b, c; clrscr(); cout<<"ENTER NUMBER1 : "; cin>>a; cout<<"ENTER NUMBER2 : "; cin>>b; cout<<"ENTER NUMBER3 : "; cin>>c; if(a>b && a>c && b>c) { cout<<a<<" IS GREATEST."<<endl; cout<<b<<" IS SECOND GREATEST."<<endl; cout<<c<<" IS LEAST."; } else if(a>b && a>c && c>b) { cout<<a<<" IS GREATEST."<<endl; cout<<c<<" IS SECOND GREATEST."<<endl; cout<<b<<" IS LEAST."; } else if(b>a && b>c && a>c) { cout<<b<<" IS GREATEST."<<endl; cout<<a<<" IS SECOND GREATEST."<<endl; cout<<c<<" IS LEAST."; } else if(a>b...

How to upload files using ASP.NET ?

Add a file browse HTML control. Right click and select 'Run as Server Control'. Add a button. Double click the button and add the following code. private void Button1_Click(object sender, System.EventArgs e) { string strFilename;  try { strFilename = File1.PostedFile.FileName; strFilename = System.IO.Path.GetFileName(strFilename); File1.PostedFile.SaveAs(@"f:\"+strFilename); } catch(Exception ex) { Response.Write(ex); } }

Some basics of ADO.NET

ADO.NET is an evolution of the ADO data access model that directly addresses user requirements for developing scalable applications. It was designed specifically for the web with scalability, statelessness, and XML in mind. ADO.NET uses some ADO objects, such as the Connection and Command objects, and also introduces new objects. Key new ADO.NET objects include the DataSet , DataReader , and DataAdapter . The important distinction between this evolved stage of ADO.NET and previous data architectures is that there exists an object -- the DataSet -- that is separate and distinct from any data stores. Because of that, the DataSet functions as a standalone entity. You can think of the DataSet as an always disconnected recordset that knows nothing about the source or destination of the data it contains. Inside a DataSet , much like in a database, there are tables, columns, relationships, constraints, views, and so forth. A DataAdapter is the object that connects to the datab...