⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wap program.cpp

📁 交换两个数的值
💻 CPP
字号:
// wap program.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include"iostream.h"
#include"string.h"
#include"stdlib.h"
#include "stdio.h"
/*
template <typename T>


void swap(T &x,T &y)
{
 T t;
 t=x;
 x=y;
 y=t;
}




void main()
{   int a,b;

	cout<<"please input two numbers:";
	cin>>a>>b;
    swap(a,b);
	cout<<"the ordered result is:";
	cout<<a<<"    "<<b<<endl;

	
}
          */

/*
int func1();
int func2();

void main()
{
  func1();
  cout<<func2()<<endl;
  
}


int func1()
{
 int n=12345;
 return n;
}

int func2()
{
 int n;
 return n;
}     




         */


/*
class student
{
     public:
	   student( int studentno=0)
	   {
	     cout<<"creat one student\n";
	     noofstudent++;
	     cout<<"noofstudent "<<noofstudent<<endl;
	     studentno=9022100+noofstudent;
	     cout<<"studentno "<<studentno<<endl;
	   }
	 
	    
		
		~student(void)
	   {
	     cout<<"destruct one student\n";
		 noofstudent--;
	   }
	   
	 
   
         static int number()
		 {
   
           return noofstudent;
		 }




      protected :
	
	    static int noofstudent;
	    int studentno;
	
};


 int student::noofstudent=0;

 void fn()
 {
 student s1;
 student s2;
 cout<<student::number()<<endl;
 
 }



 void main()
 {
  student s1;
  fn();
  cout<<student::number()<<endl;
 
 
 
 }
             */



/*
void display( double r);

int main()
{
 double d=2;
 display(d);
 return 0;
}



void display( double r)
{
 cout<<r<<endl;
}       

            */
void main()
{

    int numques=5,numcorrect=0,ques=0;
    char c;
    char key[]={'a','a','a','a','a'};
    cout<<"please input the answers:"<<endl;

   while((c=getchar())!='\0')
   {
          if(c!='\n') 
		  {
               if(c==key[ques])
			   {
	              numcorrect++;
	              cout<<" ";
			   }
               else cout<<"*";
      
		  }
   
         else
		 {
	          cout<<"correct rate is:"<<float(numcorrect)/numques*100<<"%"<<endl;
	          numcorrect=0;
	          ques=0;
	          continue;
   
		 }

      ques++;

   }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -