计数问题数 [英] count number of question

查看:84
本文介绍了计数问题数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人告诉我我有任务面试问题,当我单击第一个任务提交第二个问题时,我有10个面试问题,将显示此过程,在第十个问题提交后,此过程将持续到10个,我要计算正确的问题并显示如何许多问题是正确的.

any one tell me i am having the task interview question i am having 10 interview question when i click the first questing submit second question will display this process will continue upto 10 after tenth question submit i want to count correct question and display how many question is correct.

推荐答案

如果您不能自己解决这个问题,就不应该得到这份工作!

这是非常基本的东西-取决于您所处的环境.
在Winforms中,将正确/不正确的变量存储在类级别的bool中,并循环遍历它们的总和,或者存储整数计数的正确答案.

在网站工作中,请执行相同的操作,但是将它们存储在会话变量中.
If you can''t work this out for yourself, you do not deserve to get the job!

It''s pretty basic stuff - it just depends on what environment you are in.
In Winforms, store the correct / incorrect in a class level array of bools and just loop through totaling them, or store an integer count of correct answers instead.

In website work, do the same thing, but store them in a session variable.


您有4个选项,正确地说op1,op2,op3,op4

我将使用静态int variable ans=0;

单击按钮时;
you have 4 options right say op1,op2,op3,op4

I will take a static int variable ans=0;

when button is clicked ;
{
here i will check the correct answer in if condition 
if(op1.checked)
++ans;
else if(op2.checked)
++ans

else if(op3.checked)
++ans;
else if(op4.checked)
++ans
}


在这里您将检查哪个答案是正确的天气,它是op1,po2,op3,op3
基于该增量,ans变量

那么您将得到他已经回答的正确答案


here you will check which answer is correct weather it s op1,po2,op3,op3
based on that increment the ans variable

then you will get the correct answer that he has answered


这是一个简单的程序逻辑公式.我认为自己发现它可以使您成为一名更好的程序员.祝你好运!


问候,
爱德华
This is a simple program logic formulation. I think discovering it on your own will make you a better programmer. Good luck on you!


Regards,
Eduard


这篇关于计数问题数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆