我继续在我尝试为销售变量分配值的每一个案例中获得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) 为了隐藏页面周围的一堆不同的内容,我做...
$('#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) 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,' , ');
如果我用分隔符逗号破解/爆炸,如何使用字符串,如上所述.逐行
我需要找到给定范围内的最高素数.
这是我的代码,适用于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