void f()意味着f什么都不返回.如果void什么都不返回,那我们为什么要使用呢?主要目的是void什么?
如何在Switch语句中应用条件,我想计算平均值:但是我已经尽力解决问题,但仍然没有得到Switch语句的输出.我是C++的初学者,
#include <iostream>
using namespace std;
int main()
{
//declaration of variables.
int sub1,sub2,sub3, sub4,sub5,total,avg;
//accepting marks from user in each subject
cout << " Enter Programming in C++ Marks: " << endl;
cin >> sub1;
cout << " Enter Software Engineering Marks : " << endl;
cin >> sub2;
cout << " Enter Personal Communication Marks : " << endl;
cin >> sub3;
cout << " Enter Database Application Marks: " << endl;
cin >> sub4;
cout << " …Run Code Online (Sandbox Code Playgroud) #include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
int lop, squr;
for (lop=1; lop<=20; lop=lop+1);
{
squr = lop*lop;
printf("%5d,%5d,\n",lop,squr);
}
getch();
}
Run Code Online (Sandbox Code Playgroud)
我的朋友说的是这个源代码运行良好..但它在我身边运行不佳.我应该怎么做才能在C++中很好地工作.
我的朋友告诉我,上面提到的代码在他正在使用的版本中运行良好.我说,这段代码不正确,会给出执行错误....上面提到的代码对于任何标准或版本的C/C++都是正确的.
并告诉我有多少版本的C++可用...
问候