convert java code to c++ online
import java.util.Scanner;
class Main
{
public static void main(String args[])
{
Scanner input = new Scanner(System.in);
System.out.println("Enter the number of widgets bought");
int n = input.nextInt();
System.out.println("the sub total of "+n+" widgets is $" + (2*n) +"\n");
//assuming sales tax is 14%
float st=(float)n*2;
st=st*0.14f;
st=st+(float)(n*2);
float st1 = st;
System.out.println("the sub total of "+n+" widgets after adding sales tax is $" + st +"\n");
System.out.println("which delivery you want\n1=> ground delivery\n2=>express delivery");
int c = input.nextInt();
float sf;
if(c==1)
{
st=st+4.95f;
sf=4.95f;
System.out.println("the total of "+n+" widgets after adding delivery charges $" + st +"\n");
}
else {
System.out.println("which express delivery you want\n1=> 2 days delivery\n2=>overnight delivery");
int d = input.nextInt();
if (d == 1) {
st=(st + 9.95f);
sf=9.95f;
System.out.println("the total of " + n + " widgets after adding delivery charges $" + st + "\n");
} else {
st=(st + 18.95f);
sf=18.95f;
System.out.println("the total of " + n + " widgets after adding delivery charges $" + st + "\n");
}
}
System.out.println("number of widgets\t"+n);
System.out.println("sub total\t"+((float)n*2.0f));
System.out.println("sales tax\t"+st1);
System.out.println("subtotal with tax\t"+(((float)n*2.0f))+st1);
System.out.println("shipping fee\t"+sf);
System.out.println("total cost\t"+st);
System.out.println("number of widgets\t"+n);
// System.out.println("Press enter to exit");
}
}