小编Jon*_*ony的帖子

字符串反向没有新数组

嗨,任何人都可以告诉我这个错误吗?

#include<stdio.h>

int main()
{
    char a[]="abcdefgh";
    int i=0;
    int n=strlen(a);
    char *first;
    char *second;
    char *c;
    *first=a[0];
    *second=a[7];
    for(i=0;i<=n/2;i++)
    {
            *c=*first;
            *first=*second;
            *second=*c;
            first++;
            second--;
    }

    for(i=0;i<=7;i++)
    {
            printf("%c",a[i]);
    }
}
Run Code Online (Sandbox Code Playgroud)

c arrays string

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

函数指针错误

这个简单的代码可以帮助我吗?

#include <iostream>
using namespace std;

void testFunction(){
    cout<<"This is the test function 0"<<endl;
}

void testFunction1(){
    cout<<"This is the test function 1"<<endl;
}

void testFunction2(){
    cout<<"This is the test function 2"<<endl;
}

void (*fp[])()={testFunction,testFunction1,testFunction2};

int main(){

    //fp=testFunction;
    (*fp[testFunction1])();
    //cout<<"Addrees of the function pointer is:"<<*fp;
}
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

error: invalid types `void (*[3])()[void ()()]' for array subscript|
Run Code Online (Sandbox Code Playgroud)

c++ pointers function

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

得到一些愚蠢的语法错误

在行获取语法错误:

`List<Class> findClasses(File directory)` throws `ClassNotFoundException`...
Run Code Online (Sandbox Code Playgroud)

无法弄清楚原因.这是我的代码.

import org.apache.tools.ant.Task;
import java.util.*;
import java.io.*;

public class CreateTestPackage extends Task
{
 String allTestsFile = getProject().getProperty("alltestfiles")+ getProject().getProperty("testfile");
 public void execute()
 {
  List<Class> findClasses(File directory) throws ClassNotFoundException
  {

   List<Class> classes = new ArrayList<Class>();
   if (!directory.exists())
   {
    return classes;
   }
   File[] files = directory.listFiles(new FilenameFilter()
   {
    public boolean accept( File dir, String name )
    {
     return name.matches("test.*\\.class");
    }
   });
   for (File file : files)
   {
    if (file.isDirectory())
    {
     assert !file.getName().contains(".");
     classes.addAll(findClasses(file));
    }
    else if (file.getName().endsWith(".class")) …
Run Code Online (Sandbox Code Playgroud)

java ant

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

队列中的循环数组

mod如何用于确定队列中循环数组的开头和结尾?

java queue data-structures

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

字符串唯一字符

实现算法以确定字符串是否具有所有唯一字符.如果您不能使用其他数据结构怎么办?

string

-1
推荐指数
1
解决办法
5724
查看次数

如何将任意基数中的数字的字符串版本转换为整数?

如何将字符串转换为整数?

对于前:

  • "5328764",以int为基数10
  • "AB3F3A",以int base 16为准

任何代码都会有所帮助

string

-1
推荐指数
1
解决办法
1022
查看次数

将非结构化数据转换为结构化数据?

如何将非结构化数据转换为结构化数据?例如电子邮件联系人,从非结构化文本到结构化格式。

是否有任何算法可以做到这一点?

email parsing

-2
推荐指数
1
解决办法
3495
查看次数

标签 统计

string ×3

java ×2

ant ×1

arrays ×1

c ×1

c++ ×1

data-structures ×1

email ×1

function ×1

parsing ×1

pointers ×1

queue ×1