大家好.看看这段示例代码.
#include "stdafx.h"
#include<conio.h>
#include<string.h>
class person{
private char name[20];
private int age;
public void setValues(char n[],int a)
{
strcpy(this->name,n);
this->age=a;
}
public void display()
{
printf("\nName = %s",name);
printf("\nAge = %d",age);
}
};
int _tmain(int argc, _TCHAR* argv[])
{
person p;
p.setValues("ram",20);
p.display();
getch();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
1> ------ Build build:项目:首先,配置:调试Win32 ------ 1> first.cpp 1> c:\ documents and settings\dark wraith\my documents\visual studio 2010\projects\first\first\first.cpp(9):错误C2144:语法错误:'char'前面应加':'
1> c:\ documents and settings\dark wraith\my documents\visual studio 2010\projects\first\first\first.cpp(10):error C2144:语法错误:'int'前面应加':'
1> c:\ documents and settings\dark …
让我们说我有一个四个立方体的场景.我怎么说在OpenGL中只旋转/翻译其中两个立方体而不用glrotatef和gltranslate改变其他立方体?我不想定义自己的同质坐标.
Jus检查这个程序.从逻辑上看它看起来很好,但它为所有东西提供了000000000000000000000
#include<stdio.h>
void main()
{
int n=25,k=32;
printf("binary equivalent\n");
while(k!=0)
{
if((n>>1&0x01)!=0)
printf("1");
else
printf("0");
k--;
}
}
Run Code Online (Sandbox Code Playgroud) 我需要使用 C 修改 torrent 文件中的跟踪器,它们使用什么类型的编码?当我只打印 ascii 字符时,它们打印出乱码。或者有没有直接的方法使用 C 将跟踪器添加到 torrent 文件?
假设我们正确取消引用并使用整数权限,这是一个很好的编程习惯吗?
union {
int x;
struct node * next;
};
Run Code Online (Sandbox Code Playgroud)