C++中使用cout << endl 换行问题
刚接触C++,编了一个小程序。以度、分、秒输入纬度,以度输出,程序如下。#include"stdafx.h"#include<iostream>intmain(){usi...
刚接触C++,编了一个小程序。
以度、分、秒输入纬度,以度输出,程序如下。
#include "stdafx.h"
#include <iostream>
int main()
{
using namespace std;
const double zhuanhuan = 60.0;
int degrees,minutes,seconds;
double Degrees;
cout << "Enter a latitude in degrees, minutes, and seconds: \n";
cout << "First, enter the degrees: ";
cin >> degrees;
cout << endl << "Next, enter the minutes of arc: ";
cin >> minutes;
cout << endl << "Finally, enter the seconds of arc: ";
cin >> seconds;
cout << endl << degrees << " degrees, " << minutes << " minutes, " << seconds << " seconds = ";
Degrees = (seconds / zhuanhuan + minutes) / 60 + degrees;
cout << Degrees << " degrees\n";
cout << "Press any key to return.";
cin.get();
cin.get();
return 0;
}
为什么输出中多空了几行?
<!--<!--<!-- 展开
以度、分、秒输入纬度,以度输出,程序如下。
#include "stdafx.h"
#include <iostream>
int main()
{
using namespace std;
const double zhuanhuan = 60.0;
int degrees,minutes,seconds;
double Degrees;
cout << "Enter a latitude in degrees, minutes, and seconds: \n";
cout << "First, enter the degrees: ";
cin >> degrees;
cout << endl << "Next, enter the minutes of arc: ";
cin >> minutes;
cout << endl << "Finally, enter the seconds of arc: ";
cin >> seconds;
cout << endl << degrees << " degrees, " << minutes << " minutes, " << seconds << " seconds = ";
Degrees = (seconds / zhuanhuan + minutes) / 60 + degrees;
cout << Degrees << " degrees\n";
cout << "Press any key to return.";
cin.get();
cin.get();
return 0;
}
为什么输出中多空了几行?
<!--<!--<!-- 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询