小编Lin*_*een的帖子

C#中的System.FormatException

我继续在我尝试为销售变量分配值的每一个案例中获得FormatException.谁知道我做错了什么?我应该把这个控制台程序作为学习循环的作业,但我发现更多关于其他事情.它应该按照每次销售的10%佣金保持销售人员佣金的运行标签.无论如何,这里是代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TubSales
{
   class Program
   {
      static void Main(string[] args)
      {
         char initial;
         const double COMM_INT = 0.10;
         double sale, aComm = 0, bComm = 0, eComm = 0;
         Console.Write("Enter 'A' for Andrea, 'B' for Brittany,\n'E' for Eric, or 'Z' to quit >> ");
         initial = Convert.ToChar(Console.Read());
         while (initial != 'z' && initial != 'Z')
         {
            switch (initial)
            {
               case 'a':
               case 'A':
                  Console.Write("Enter the sales for Andrea >> ");
                  sale …
Run Code Online (Sandbox Code Playgroud)

c# formatexception

0
推荐指数
1
解决办法
2155
查看次数

jquery - 如何在ID选择器中看到通配符

为了隐藏页面周围的一堆不同的内容,我做...

$('#objective_details, #time_estimate_details, #team_members_details, #resources_details').hide();
Run Code Online (Sandbox Code Playgroud)

有没有办法做某种通配符,如

$('#*_details').hide();
Run Code Online (Sandbox Code Playgroud)

html javascript jquery

0
推荐指数
1
解决办法
116
查看次数

ifstream获取从char到string的换行输出

C++ ifstream获取从char到string的换行getline输出

我有一个文本文件..所以我读了它,我做了类似的事情

char data[50];
readFile.open(filename.c_str());

while(readFile.good())
{
readFile.getline(data,50,',');

cout << data << endl;

}
Run Code Online (Sandbox Code Playgroud)

我的问题是,不是通过变量名数据创建大小为50的字符,我可以将getline变为字符串而不是像

string myData;
readFile.getline(myData,',');
Run Code Online (Sandbox Code Playgroud)

我的文本文件是这样的

Line2D,[3,2] Line3D,[7,2,3]

我试过,编译器说..

没有匹配的getline函数(std :: string&,char)

所以仍然可以通过分隔符来分解,将值赋给字符串而不是char.

更新:

运用

while (std::getline(readFile, line))
{
    std::cout << line << std::endl;
}
Run Code Online (Sandbox Code Playgroud)

它逐行读取,但我想将字符串分成几个分隔符,原来如果使用char我将指定分隔符作为第3个元素是

readFile.getline(data,50,' , ');

如果我用分隔符逗号破解/爆炸,如何使用字符串,如上所述.逐行

c++ ifstream

0
推荐指数
1
解决办法
2779
查看次数

找到给定范围内的最高素数

我需要找到给定范围内的最高素数.
这是我的代码,适用于0-100,但如果我给0-125,它显示素数为125.

<?php
    $flag=0;
    $b=125;
    for($i=$b;$i>=0;$i--)
    {
        if($i%2!=0)
        {
            for($b=3;$b<10;$b++)
            {
                if($flag==0)
                {
                    echo('<br>');
                    if($i%$b!=0)
                    {
                        echo('highest prime number is'.$i);
                        $flag=1;
                        break;
                    }
                    elseif ($i%$b==0)
                    {
                        break;
                    }
                }
            }
        }
    }
?>
Run Code Online (Sandbox Code Playgroud)

在上面的代码中,我的范围是0-125

php arrays primes

0
推荐指数
1
解决办法
1597
查看次数

标签 统计

arrays ×1

c# ×1

c++ ×1

formatexception ×1

html ×1

ifstream ×1

javascript ×1

jquery ×1

php ×1

primes ×1