+ 4

Input and output

Write a program that prints a text of 4 lines consisting of characters, integer values and floating-point values using cout statement.

22nd May 2018, 5:10 AM
Ncker
Ncker - avatar
32 Antworten
+ 37
Noel Widler its ok, if it would be homeworks, if i could i would help, but as i see, you have help enough 👍😉
6th Jun 2018, 4:00 PM
tooselfish
tooselfish - avatar
+ 28
an easy way to become the homeworks without any efforts 👍😉
22nd May 2018, 2:08 PM
tooselfish
tooselfish - avatar
+ 28
Timon Paßlick just thoughts, the question looks like
22nd May 2018, 2:18 PM
tooselfish
tooselfish - avatar
+ 12
#include<iostream> #include<conio.h> void main() { clrscr();    int i1, i2, i3, i4;  i1 = 234 , i2 = 360, i3 = 796, i4 = 1344;    float fl1, fl2, fl3, fl4;    fl1 = 34.5, fl2 = 7.12, fl3 = 112.12, fl4 = 3.14;  char ch1, ch2, ch3, ch4; ch1 = '#', ch2 = '@', ch3 = '>', ch4 = '|';    cout<<"Integers: "<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<endl;    cout<<"Floats: "<<fl1<<" "<<fl2<<" "<<fl3<<" "<<fl4<<endl;    cout<<"Characters: "<<ch1<<" "<<ch2<<" "<<ch3<<" "<<ch4<<endl;    cout<<"We have Displayed the text in 4 lines Using [ cout<< ] statment";    getch(); }
22nd May 2018, 5:14 AM
Abhivarshini Maddala
Abhivarshini Maddala - avatar
+ 5
#include<iostream.h> #include<conio.h> void main() { clrscr();     char S='SoloLearn';     int i=100;     float f=3.14;     cout<<"Hello World"<<endl;     cout<<"Character Value: "<<S<<endl;     cout<<"Integer Value: "<<i<<endl;     cout<<"Floating Point Value: "<<f<<endl;     getch(); }
22nd May 2018, 9:55 AM
Sandeep Vaghela
Sandeep Vaghela - avatar
+ 4
#include <iostream> int main() { std::cout << R"(characters 1 2 3 1.5 2.3 7.98022)"; }
22nd May 2018, 2:00 PM
Timon Paßlick
+ 4
Abhi Varshini <iostream> should be written without the .h extension. And neither do you use conio nor is it part of the official language standard. Apart from that, good example.
22nd May 2018, 2:03 PM
Timon Paßlick
+ 4
The location of an error is shown with a line:column pair, at least with this compiler. 4:11 led to "int main" instead of "void main". Your main must return int. 6:11 You forgot "=". 9:1 You forgot a ";". 13:1 Don't use "getch". Tanay just left it away.
5th Jun 2018, 8:06 PM
Timon Paßlick
+ 2
Sandeep Vaghela Please test your code before posting, that does not compile.
22nd May 2018, 2:01 PM
Timon Paßlick
+ 2
tooselfish If it's really homework and he keeps on doing that, one day, noone's going to help him and he'll get an F.
22nd May 2018, 2:17 PM
Timon Paßlick
+ 2
//copy and paste #include <iostream> using namespace std; int main() { int marks = 57; float avg =32.3; char grade='A'; cout<<"I am Widler Noel;"<<endl; cout<<"My total Marks are;"<<marks<<endl; cout<<"My average is;"<<avg<<endl; cout<<"My grade is;"<<grade; }
5th Jun 2018, 6:49 PM
Tanay
Tanay - avatar
+ 2
thank you so much bro!! that’s really helpful.
5th Jun 2018, 8:09 PM
Ncker
Ncker - avatar
+ 1
Timon Paßlick I wrote it down without the h it still doesn’t work🤔
5th Jun 2018, 6:21 PM
Ncker
Ncker - avatar
+ 1
Noel Widler Without the clrscr()? And does my solution work?
5th Jun 2018, 6:27 PM
Timon Paßlick
+ 1
you mean take the clescr out?
5th Jun 2018, 6:32 PM
Ncker
Ncker - avatar
+ 1
Yep.
5th Jun 2018, 6:33 PM
Timon Paßlick
+ 1
his my code let me know what i did wrong: #include <iostream> using namespace std; void main() { int marks = 57; float avg =32.3; char grade='A'; cout<<"I am Widler Noel;"<<endl; cout<<"My total Marks are;"<<marks<<endl; cout<<"My average is;"<<avg<<endl; cout<<"My grade is;"<<grade; getch(); }
5th Jun 2018, 6:33 PM
Ncker
Ncker - avatar
+ 1
Does my solution work?
5th Jun 2018, 6:33 PM
Timon Paßlick
+ 1
int main
5th Jun 2018, 6:34 PM
Timon Paßlick
+ 1
oh gotcha
5th Jun 2018, 6:34 PM
Ncker
Ncker - avatar