Printing an output after a variable input.

I would like to know how to to print
Line 11 and Line 13 in the same line but to enter variable in between of them.

Like:
Unesite cenu parkinga po satu [din]. . . [Variable] din.

Thanks in advance

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include <iomanip>
#include <stdlib.h>

using namespace std;

void main()
{
	double cena;
	float h, min, PDV;
	cout << "Unesite cenu parkinga po satu [din]. . .";
	cin >> cena;
	cout << "din";
	cout << "Unesite trajanje parkiranja [h min] . . .";
	cin >> h >> min;
	double vmin = h * 60 + min;
	float racun = 1.*cena / 60 * vmin;
	PDV = (racun / 100) * 23;
	cout << "\n\nRacun za parking : \t" << racun << endl;
	cout << "Iznos PDV-a : " << PDV << endl;

	system("pause");
}
You can't read and write in a single statement in this language.

I am not quite able to read your language well enough to see what you want to do. Are you wanting to write the 2 statements on a single line without the reading interruption? You would have to read cena first, then do a single print statement to do that.

like

cin >> cena;
cout << "Unesite cenu parkinga po satu [din]. . ."<< "din";
Last edited on
I wanted to print the second statement right after entering a variable (Not ending the line after input),but i googled a little bit after this post,and i found out that Enter automaticaly ends the line,but it's also required to read the variable,so it is quite imposible to do what i was planing to do.So Nvm I'll do it another way

Anywhay,Tnanks for replying ;)
Topic archived. No new replies allowed.