小编Jac*_*cob的帖子

识别给定数字中的数字.

我是编程新手,而且我遇到了问题.我希望我的程序识别给定数字中的单独数字,如果我输入4692,它应该识别数字并打印4 6 9 2.是的,不使用数组.

c c++ numbers digits

3
推荐指数
1
解决办法
6031
查看次数

为什么我的代码没有打印到stdout?

我正在尝试计算学生成绩的平均值:

import java.util.Scanner;

public class Average

{

    public static void main(String[] args)
    {
        int mark;
        int countTotal = 0;  // to count the number of entered marks
        int avg = 0;        // to calculate the total average
        Scanner Scan = new Scanner(System.in);

        System.out.print("Enter your marks: ");
        String Name = Scan.next();

        while (Scan.hasNextInt())
        {
            mark = Scan.nextInt();
            countTotal++;

            avg = avg + ((mark - avg) / countTotal);
        }


        System.out.print( Name + "  " + avg );
    } 
}
Run Code Online (Sandbox Code Playgroud)

java

3
推荐指数
1
解决办法
451
查看次数

每当我们使用构建配置时,为什么Expression Blend 4的设计师不工作?

我在使用Expression Blend 4时遇到了一个奇怪的问题.我一直在使用Blend 4和Visual Studio 2010一段时间而没有发生任何事故(除了超常频繁的崩溃).现在我们的图形设计师想要开始使用Blend来做一些修饰工作.

我们能够让Blend在他的计算机上编译解决方案.不幸的是,当我们尝试打开任何XAML文件时,我们从设计者那里得到错误,其中通过合并资源字典和附加属性包含的资源无法识别.基本上,即使Blend正在编译没有错误的解决方案,也好像看不到构建工件.

我们的设置中唯一奇怪的是我们的解决方案包含多个构建配置,您无法在Blend中更改构建配置.

为什么你认为Blend的设计者无法加载它构建的文件?

silverlight designer build expression-blend silverlight-4.0

3
推荐指数
1
解决办法
1738
查看次数

c ++ for_each()和对象函数

我的作业如下:

对于给定的整数数组,找到其元素的总和并打印出最终结果,但是为了获得总和,您需要在STL中仅执行一次函数for_each()(没有循环).

截至目前这是我的代码:

void myFunction (int i) {
cout << " " << i << " " <<  endl;
} 


int main() {

int array[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

vector<int> v(array[0], array[10]);

for_each( v.begin(), v.end(), myFunction);

return 0;
}
Run Code Online (Sandbox Code Playgroud)

但由于某种原因,输出显示为4198853,起初我认为它是一个内存地址,但我发现这是错误的.有什么想法,我可能做错了什么?

c++

3
推荐指数
1
解决办法
1659
查看次数

如何在.NET中不使用乘法运算符来实现乘法

我想在.NET中实现两个整数的乘法而不使用乘法运算符

public uint MultiplyNumbers(uint x, uint y)
{

}
Run Code Online (Sandbox Code Playgroud)

任何的想法!

.net c# operators multiplication

3
推荐指数
3
解决办法
2万
查看次数

在java中输出一个方块到控制台

嗨,我正在做我的课程,我被赋予的任务是使用"*"制作一个5x5的正方形算法,但必须用"."填写.像这样:

*****
*...*
*...*
*...*
*****
Run Code Online (Sandbox Code Playgroud)

我使用过这段代码我知道它可能非常混乱,因为我是这个东西的绝对初学者.我似乎无法得到"." 在我目前有:

*****
*****
*****
*****
*****
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

public static void main( String args[] )
{
    System.out.print ("#size of square");
    int stars=BIO.getInt();
    int j=1;
    while(j <= stars)
    {
        int starsNumber=1;
        while (starsNumber<= stars)
        {
            int i = 1;                        // Display trunk
            starsNumber=starsNumber+1;
            System.out.print('*');
        }
        System.out.println();

        j= j +1;
    }
}
Run Code Online (Sandbox Code Playgroud)

抱歉,编码非常糟糕:D和任何帮助都将非常感谢Gareth

java algorithm

3
推荐指数
1
解决办法
2393
查看次数

如何使用迭代来插入HTML

我有以下难看的硬代码:

<div class="label">
    <p id="CO-0"></p>
    <p id="CO-1"></p>
    <p id="CO-2"></p>
    <p id="CO-3"></p>
</div>
Run Code Online (Sandbox Code Playgroud)

如何在JavaScript中使用迭代自动插入0,1,2和3 pid?

这是我的开始:

for (i = 0; i< 3; i +=1){
    $('.label').html('<p id='+[i]+'></p>');
} 
Run Code Online (Sandbox Code Playgroud)

html javascript jquery loops

3
推荐指数
2
解决办法
2304
查看次数

ASP.NET请求在此上下文中不可用

当我尝试打开网站时,我遇到了这个问题,我不知道它有什么问题.我用它编辑了堆栈跟踪

    Server Error in '/' Application.

    Request is not available in this context

    Description: An unhandled exception occurred during the execution of the current web  request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: Request is not available in this context

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be …

asp.net

3
推荐指数
1
解决办法
3万
查看次数

验证xml的有效方法?

我需要尽可能快地验证并在socket上接收下一个xml数据.

我正在使用此方法来验证收到的xml-datas.

private validateRecievedXmlCallback()
{
  try
  {      
    XmlReader xreader = XmlReader.Create(new StringReader(xmlData));
    while (xreader.Read()) ;
  }
  catch (Exception)
  {
    return false;
  }

  return true;
}
Run Code Online (Sandbox Code Playgroud)

但我认为这种方法效率不高.我实际上只需要检查最后一个标签.

例:

<test valueA="1" valueB="2">
   <data valueC="1" />
   <data valueC="5" />
   <data valueC="5">220</data>
</test>  //I need to check if </test> tag closed, but whats the best way to do it?
Run Code Online (Sandbox Code Playgroud)

c# xml

3
推荐指数
1
解决办法
707
查看次数

从MVC控制器获取FileStream到客户端

我使用下面的代码将文件流放入由 MVC 控制器返回的响应消息中。但是如何在客户端获取流?任何评论高度赞赏!谢谢!

服务器:

string filename = @"c:\test.zip";

FileStream fs = new FileStream(filename, FileMode.Open);

HttpResponseMessage response = new HttpResponseMessage();

response.Content = new StreamContent(fs);
response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");

return response;
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc asp.net-mvc-4

3
推荐指数
1
解决办法
2万
查看次数